A tracked file replaced by a folder can pull left-out files into the snapshot #121

Closed
opened 2026-10-25 02:01:29 -05:00 by ethan-hann · 0 comments
Owner

When a recorded file a becomes a folder a/ holding a/b and a/junk.tmp, and the leave-out rules name *.tmp, a capture passes the literal pathspec a (for the removal) to git add -f. That pathspec matches the whole folder, so -f adds a/junk.tmp although the rules name it (reproduced with the bundled git 2.56). It happens in the single unwatched add and whenever a and a/b land in the same group; if a/b is 128 MiB or more, the a pathspec also streams it in an earlier group and writes a second pack. Record such removals with update-index --remove (or git rm --cached) instead of passing them to add, and test that the left-out file stays out.

When a recorded file `a` becomes a folder `a/` holding `a/b` and `a/junk.tmp`, and the leave-out rules name `*.tmp`, a capture passes the literal pathspec `a` (for the removal) to `git add -f`. That pathspec matches the whole folder, so `-f` adds `a/junk.tmp` although the rules name it (reproduced with the bundled git 2.56). It happens in the single unwatched add and whenever `a` and `a/b` land in the same group; if `a/b` is 128 MiB or more, the `a` pathspec also streams it in an earlier group and writes a second pack. Record such removals with `update-index --remove` (or `git rm --cached`) instead of passing them to `add`, and test that the left-out file stays out.
ethan-hann added this to the 1.0 milestone 2026-10-25 02:01:29 -05:00
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
ethan-hann/SavePoint#121
No description provided.