Correct parsing of empty file additions

pmeunier
Dec 8, 2021, 10:45 AM
WSHEZ4KQQTWFHCOXWMXAQRSI7656VDYODMNAGOLDYJIAM3CZCXXAC

Dependencies

  • [2] FGIVSUFH Fixing conflicts with the new patch parsing code, and introducing AddRoot
  • [3] VO5OQW4W Removing anyhow in libpijul
  • [4] CCFJ7VO3 Renaming "Record" to "Hunk" in the changes
  • [5] 5FI6SBEZ Re-implement change printing and parsing
  • [6] UN2M77YU Test new changes against the old code. Fix several small bugs.
  • [7] YDMAIJ5V Fixing the format of text changes (file additions under a new directory were not always accepted by the parser)

Change contents

  • replacement in libpijul/src/change/text_changes.rs at line 708
    [3.26185][3.26185:26222]()
    let contents_res = {
    [3.26185]
    [3.26222]
    let contents = if contents.len() > 0 {
  • replacement in libpijul/src/change/text_changes.rs at line 723
    [3.26945][3.26945:26967]()
    x
    [3.26945]
    [3.26967]
    Some(Atom::NewVertex(x))
    } else {
    None
  • replacement in libpijul/src/change/text_changes.rs at line 732
    [3.60800][3.27023:27090]()
    contents: Some(Atom::NewVertex(contents_res)),
    [3.60800]
    [2.2470]
    contents,
  • edit in libpijul/src/change/text_changes.rs at line 790
    [3.28914]
    [3.28914]
    assert!(!contents.is_empty());
  • replacement in libpijul/src/change/text_changes.rs at line 894
    [3.32274][3.32274:32353]()
    // TODO: this code block looks suspect. Check the correctness.
    [3.32274]
    [3.32353]
    // If `contents.is_empty()`, we still need to add a
    // new empty vertex, so the following is ok:
  • edit in libpijul/src/change/text_changes.rs at line 902
    [2.3690][3.32637:32711](),[3.60220][3.32637:32711](),[3.32637][3.32637:32711]()
    // TODO: this maths is probably unnecessarily complicated