Keep the real names of files whose names changed on disk #56

Merged
jcoffey-dev merged 1 commits from feat/file-real-names into main 2026-10-31 22:08:02 +00:00
Owner

Closes the last gap the account export layout had: a file, directory or link whose name had to change on disk (a leading dot, a : or ?, a name Windows reserves, a clash by case) came back with the changed name.

export-files now writes files.names in the manifest: the real name of each entry whose name changed, keyed by its path on disk. import files restores them. Entries that keep their names claim them first, so a real name that's already taken in its directory, or one that can't be a name (empty, ., .., or with / or NUL), leaves the entry with its name on disk and a warning. A listed link whose name is taken is not made, where before it would have replaced the entry with that name.

The member is new and optional and readers ignore members they don't know, so the layout stays at formatVersion 1. The spec change follows on coffeylabs.org.

Tests: the round-trip fixture gains a hidden file, names with : and ?, a directory that needs renaming, a top-level clash by case and a link named CON; export, import and export again still gives the same tree and manifest. A new test renames a file onto its sibling directory, one to ../escape, one to an empty name and a link onto a file, and checks nothing takes another's place. fmt, clippy and the full suite pass locally.

Closes the last gap the account export layout had: a file, directory or link whose name had to change on disk (a leading dot, a `:` or `?`, a name Windows reserves, a clash by case) came back with the changed name. `export-files` now writes `files.names` in the manifest: the real name of each entry whose name changed, keyed by its path on disk. `import files` restores them. Entries that keep their names claim them first, so a real name that's already taken in its directory, or one that can't be a name (empty, `.`, `..`, or with `/` or NUL), leaves the entry with its name on disk and a warning. A listed link whose name is taken is not made, where before it would have replaced the entry with that name. The member is new and optional and readers ignore members they don't know, so the layout stays at formatVersion 1. The spec change follows on coffeylabs.org. Tests: the round-trip fixture gains a hidden file, names with `:` and `?`, a directory that needs renaming, a top-level clash by case and a link named `CON`; export, import and export again still gives the same tree and manifest. A new test renames a file onto its sibling directory, one to `../escape`, one to an empty name and a link onto a file, and checks nothing takes another's place. fmt, clippy and the full suite pass locally.
jcoffey-dev added 1 commit 2026-10-31 22:03:38 +00:00
Keep the real names of files whose names changed on disk
ci / test (pull_request) Skipped
github/ci (branch) GitHub Actions
ci / github (pull_request) Successful in 3m53s
ci / announce (pull_request) Skipped
6878fcc83f
export-files lists the real name of every file, directory and link whose name had to change in the manifest's files.names, by its path on disk, and import files restores them. Entries that keep their names claim them first, so a real name already taken in its directory, or one that can't be a name, leaves the entry with its name on disk and a warning; a listed link whose name is taken is not made rather than replacing the entry there. The member is new and optional, so the layout stays at formatVersion 1.
jcoffey-dev merged commit ae707358e3 into main 2026-10-31 22:08:02 +00:00
jcoffey-dev deleted branch feat/file-real-names 2026-10-31 22:08:02 +00:00
Sign in to join this conversation.