Adding empty directories to archives

[?]
Jan 13, 2021, 9:09 AM
SECWDBUHJUJJD42LVFZEAUFR56B4OFWYW34H7PQ5Y7QNTPVIXYOQC

Dependencies

  • [2] I3OVP3NH Archive: set the accurate and deterministic mtime
  • [*] SXEYMYF7 Fixing the bad changes in history (unfortunately, by rebooting).
  • [*] VO5OQW4W Removing anyhow in libpijul
  • [*] CCLLB7OI Upgrading to Sanakirja 0.15 + version bump

Change contents

  • edit in libpijul/src/output/archive.rs at line 11
    [2.80]
    [5.25036]
    fn create_dir(&mut self, path: &str, mtime: u64, permissions: u16) -> Result<(), Self::Error>;
  • edit in libpijul/src/output/archive.rs at line 69
    [4.691768]
    [5.25143]
    fn create_dir(&mut self, path: &str, mtime: u64, permissions: u16) -> Result<(), Self::Error> {
    let mut header = tar::Header::new_gnu();
    header.set_mode(permissions as u32);
    header.set_mtime(mtime);
    header.set_entry_type(tar::EntryType::Directory);
    if let Some(ref prefix) = self.prefix {
    let path = prefix.clone() + path;
    self.archive.append_data(&mut header, &path, &[][..])?;
    } else {
    self.archive.append_data(&mut header, &path, &[][..])?;
    }
    Ok(())
    }
  • edit in libpijul/src/output/archive.rs at line 214
    [4.694938]
    [4.694938]
    let len = next_files.len();
  • edit in libpijul/src/output/archive.rs at line 225
    [6.88277]
    [4.695301]
    if len == next_files.len() {
    arch.create_dir(&path, latest_touch, output_item.meta.permissions()).map_err(ArchiveError::A)?;
    }