Skip to content

Commit

Permalink
fix handling of multiple untracked files for git mv -k
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
  • Loading branch information
Michael J Gruber authored and gitster committed Jan 14, 2009
1 parent 3772923 commit be17262
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions builtin-mv.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
memmove(destination + i,
destination + i + 1,
(argc - i) * sizeof(char *));
i--;
}
} else
die ("%s, source=%s, destination=%s",
Expand Down
2 changes: 1 addition & 1 deletion t/t7001-mv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ test_expect_success \
test -f untracked1 &&
test ! -f path0/untracked1'

test_expect_failure \
test_expect_success \
'checking -k on multiple untracked files' \
'touch untracked2 &&
git mv -k untracked1 untracked2 path0 &&
Expand Down

0 comments on commit be17262

Please sign in to comment.