@matheusbsbs / matheus-bagliano / commits / be17262d13
Fork 0

fix handling of multiple untracked files for git mv -k

The "-k" option to "git mv" should allow specifying multiple untracked files. Currently, multiple untracked files raise an assertion if they appear consecutively as arguments. Fix this by decrementing the loop index after removing one entry from the array of arguments. Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Michael J Gruber committed Jan 14, 2009 at 18:03 UTC be17262d13f5f3df5ee9635b11dad180613e9cbd
2 files changed +2 -1
builtin-mv.c
+1
@@ -192,6 +192,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
192 memmove(destination + i,
193 destination + i + 1,
194 (argc - i) * sizeof(char *));
195 + i--;
196 }
197 } else
198 die ("%s, source=%s, destination=%s",
t/t7001-mv.sh
+1 -1
@@ -49,7 +49,7 @@ test_expect_success \
49 test -f untracked1 &&
50 test ! -f path0/untracked1'
51
52 -test_expect_failure \
52 +test_expect_success \
53 'checking -k on multiple untracked files' \
54 'touch untracked2 &&
55 git mv -k untracked1 untracked2 path0 &&