Skip to content

Handle empty directories #85

@kshitijl

Description

@kshitijl

Hi! I'd like to use filepack as part of my backup process. I'm glad I found it because it's exactly the thing I wanted to write.

Some of the directories I'm backing up have empty subdirectories from various builds or downloads that have happened there. I'd still like to use filepack for these. I'd be happy to write the code for it and submit a pull request, but I wanted to open this issue to see if that's something you'd be interested in.

Options:

  1. Just ignore empty directories and don't put them in the manifest. This has the downside of being surprising: two directories can have different contents (in terms of empty directories) but the same manifest.
  2. Put empty directories in the manifest with size 0 and whatever blake3 produces for hashing null. This has the downside of putting a directory in the manifest when everything else is files.
  3. A separate empty_directories section which lists them. This is clean and explicit, but makes the manifest schema a little more complicated. This field should be omitted when there are no empty directories.

Let me know if any of these or some other option sounds like something you'd support. Again, I'd be happy to implement it and send a PR.

Why not just delete empty subdirectories?

Most importantly, some of them are inside the .git subdirectory, like refs/heads and refs/tags, and I'm not sure what the semantics are for just deleting them. I can imagine other tools that use the existence or nonexistence of empty subdirectories, or that create a subdirectory at some initialization point and then expect it to be there later.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions