Skip to content

Commit 3772923

Browse files
Michael J Grubergitster
authored andcommitted
add test cases for "git mv -k"
Add test cases for ignoring nonexisting and untracked files using the -k option to "git mv". There is one known breakage related to multiple untracked files specfied as consecutive arguments. Signed-off-by: Michael J Gruber <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3d1d81e commit 3772923

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

t/t7001-mv.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,31 @@ test_expect_success \
3838
'git diff-tree -r -M --name-status HEAD^ HEAD | \
3939
grep "^R100..*path1/COPYING..*path0/COPYING"'
4040

41+
test_expect_success \
42+
'checking -k on non-existing file' \
43+
'git mv -k idontexist path0'
44+
45+
test_expect_success \
46+
'checking -k on untracked file' \
47+
'touch untracked1 &&
48+
git mv -k untracked1 path0 &&
49+
test -f untracked1 &&
50+
test ! -f path0/untracked1'
51+
52+
test_expect_failure \
53+
'checking -k on multiple untracked files' \
54+
'touch untracked2 &&
55+
git mv -k untracked1 untracked2 path0 &&
56+
test -f untracked1 &&
57+
test -f untracked2 &&
58+
test ! -f path0/untracked1
59+
test ! -f path0/untracked2'
60+
61+
# clean up the mess in case bad things happen
62+
rm -f idontexist untracked1 untracked2 \
63+
path0/idontexist path0/untracked1 path0/untracked2 \
64+
.git/index.lock
65+
4166
test_expect_success \
4267
'adding another file' \
4368
'cp ../../README path0/README &&

0 commit comments

Comments
 (0)