]> git.ipfire.org Git - thirdparty/git.git/commit
t2500: add various tests for nuking untracked files
authorElijah Newren <newren@gmail.com>
Fri, 24 Sep 2021 06:37:04 +0000 (06:37 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 24 Sep 2021 16:24:25 +0000 (09:24 -0700)
commit446cc5544a3cb8dbd0ddac5bc5b160a687eb6471
treec781ae7d26dbf079d7d9a0edd487a46e4a825b9c
parent04d3761db214512fa29db39bd43e0b162396045c
t2500: add various tests for nuking untracked files

Noting that unpack_trees treats reset=1 & update=1 as license to nuke
untracked files, I looked for code paths that use this combination and
tried to generate testcases which demonstrated unintentional loss of
untracked files and directories.  I found several.

I also include testcases for `git reset --{hard,merge,keep}`.  A hard
reset is perhaps the most direct test of unpack_tree's reset=1 behavior,
but we cannot make `git reset --hard` preserve untracked files without
some migration work.

Also, the two commands `checkout --force` (because of the --force) and
`read-tree --reset` (because it's plumbing and we need to keep it
backward compatible) were left out as we expect those to continue
removing untracked files and directories.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t2500-untracked-overwriting.sh [new file with mode: 0755]