Remove the directory marker when a directory is deleted (and add it when a file in the inodes table is not in the tree, which is a bizarre situation)

pmeunier
Aug 2, 2021, 9:07 PM
O6HIGFLTOUHRVPRTNQSH7HSI44PAPLVYGHFSCKQC2M6ZRYZKUCBQC

Dependencies

  • [2] I24UEJQL Various post-fire fixes
  • [*] SXEYMYF7 Fixing the bad changes in history (unfortunately, by rebooting).
  • [*] YN63NUZO Sanakirja 1.0

Change contents

  • edit in libpijul/src/output/output.rs at line 424
    [2.80443]
    [4.681836]
    // The directory marker is necessarily already there,
    // since the path is in the tree.
    if output_item.meta.is_dir() {
    let path_id = OwnedPathId {
    parent_inode: inode,
    basename: SmallString::new(),
    };
    assert_eq!(txn_.get_tree(&path_id, None).unwrap(), Some(&inode))
    }
  • edit in libpijul/src/output/output.rs at line 444
    [2.80802]
    [4.682297]
    if output_item.meta.is_dir() {
    let path_id = OwnedPathId {
    parent_inode: inode,
    basename: SmallString::new(),
    };
    txn_.put_tree(&path_id, &inode)?;
    }
  • edit in libpijul/src/output/output.rs at line 575
    [5.121802]
    [5.121802]
    // In case this is a directory, we also need to delete the marker:
    let file_id_ = OwnedPathId {
    parent_inode: *inode,
    basename: SmallString::new(),
    };
    txn.del_tree(&file_id_, Some(&inode))?;