зеркало из https://github.com/microsoft/git.git
t7300: add testcases showing failure to clean specified pathspecs
Someone brought me a testcase where multiple git-clean invocations were required to clean out unwanted files: mkdir d{1,2} touch d{1,2}/ut touch d1/t && git add d1/t With this setup, the user would need to run git clean -ffd */ut twice to delete both ut files. A little testing showed some interesting variants: * If only one of those two ut files existed (either one), then only one clean command would be necessary. * If both directories had tracked files, then only one git clean would be necessary to clean both files. * If both directories had no tracked files then the clean command above would never clean either of the untracked files despite the pathspec explicitly calling both of them out. A bisect showed that the failure to clean out the files started with commitcf424f5fd8
("clean: respect pathspecs with "-d", 2014-03-10). However, that pointed to a separate issue: while the "-d" flag was used by the original user who showed me this problem, that flag should have been irrelevant to this problem. Testing again without the "-d" flag showed that the same buggy behavior exists without using that flag, and has in fact existed since beforecf424f5fd8
. Although these problems at first are perceived to be different (e.g. never clearing out the requested files vs. taking multiple invocations to get everything cleared out), they are actually just different manifestations of the same problem. The case with multiple directories that have no tracked files is the more general case; solving it will solve all the others. So, I concentrate on it. Add testcases showing that multiple untracked files within entirely untracked directories cannot be cleaned when specifying these files to git clean via pathspecs. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
502c386ff9
Коммит
7541cc5302
|
@ -691,6 +691,38 @@ test_expect_failure 'git clean -d skips nested repo containing ignored files' '
|
|||
test_path_is_file nested-repo-with-ignored-file/file
|
||||
'
|
||||
|
||||
test_expect_failure 'git clean handles being told what to clean' '
|
||||
mkdir -p d1 d2 &&
|
||||
touch d1/ut d2/ut &&
|
||||
git clean -f */ut &&
|
||||
test_path_is_missing d1/ut &&
|
||||
test_path_is_missing d2/ut
|
||||
'
|
||||
|
||||
test_expect_failure 'git clean handles being told what to clean, with -d' '
|
||||
mkdir -p d1 d2 &&
|
||||
touch d1/ut d2/ut &&
|
||||
git clean -ffd */ut &&
|
||||
test_path_is_missing d1/ut &&
|
||||
test_path_is_missing d2/ut
|
||||
'
|
||||
|
||||
test_expect_failure 'git clean works if a glob is passed without -d' '
|
||||
mkdir -p d1 d2 &&
|
||||
touch d1/ut d2/ut &&
|
||||
git clean -f "*ut" &&
|
||||
test_path_is_missing d1/ut &&
|
||||
test_path_is_missing d2/ut
|
||||
'
|
||||
|
||||
test_expect_failure 'git clean works if a glob is passed with -d' '
|
||||
mkdir -p d1 d2 &&
|
||||
touch d1/ut d2/ut &&
|
||||
git clean -ffd "*ut" &&
|
||||
test_path_is_missing d1/ut &&
|
||||
test_path_is_missing d2/ut
|
||||
'
|
||||
|
||||
test_expect_success MINGW 'handle clean & core.longpaths = false nicely' '
|
||||
test_config core.longpaths false &&
|
||||
a50=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &&
|
||||
|
|
Загрузка…
Ссылка в новой задаче