Skip to main content

colliding_paths

Function colliding_paths 

Source
pub fn colliding_paths(
    target: &Listing,
    source_paths: &[Vec<u8>],
) -> (HashSet<Vec<u8>>, Vec<Vec<u8>>)
Expand description

The paths and subtrees a filesystem that folds case cannot keep apart.

Where two tracked paths differ only by case, only one file can exist, and real git worktree add settles which by checking every entry out in index order: the last one written unlinks and recreates the shared file, so it decides both the name on disk and the content, and the other path is reported modified. Cloning even one member wins a collision git would have lost, which spec §3.5.1 forbids, and inverts the dirty set. So a whole group goes to git, which settles it exactly as it always would.

The fold is ASCII, which is what git’s own case-insensitive comparisons use. A filesystem that also folds beyond ASCII, as APFS does, can still collide on paths this leaves in the plan; the clone of the second one fails and demotes the run, which is slow rather than wrong.

On a case-sensitive filesystem this costs a handful of paths and changes nothing else.