path: root/t/
diff options
authorJunio C Hamano <>2010-01-22 22:17:06 (GMT)
committerJunio C Hamano <>2010-01-22 22:31:30 (GMT)
commitaf82559b435aa2a18f38a4f47a93729c8dc543d3 (patch)
tree1b778e52a005cdd96b3f59c6439c88a9ec83e0f8 /t/
parent30c9e919b6ef33b0427a3ad784ed9e951ea48648 (diff)
git-mv: fix moving more than one source to a single destination
The code used as if return value from basename(3) were stable, but often the function is implemented to return a pointer to a static storage internal to it. Because basename(3) is also allowed to modify its input parameter in place, casting constness away from the strings we obtained from the caller and giving them to basename is a no-no. Reported, and initial fix and test supplied by David Rydh. Signed-off-by: Junio C Hamano <>
Diffstat (limited to 't/')
1 files changed, 12 insertions, 0 deletions
diff --git a/t/ b/t/
index 10b8f8c..65a35d9 100755
--- a/t/
+++ b/t/
@@ -189,6 +189,18 @@ test_expect_success 'absolute pathname outside should fail' '(
+test_expect_success 'git mv to move multiple sources into a directory' '
+ rm -fr .git && git init &&
+ mkdir dir other &&
+ >dir/a.txt &&
+ >dir/b.txt &&
+ git add dir/?.txt &&
+ git mv dir/a.txt dir/b.txt other &&
+ git ls-files >actual &&
+ { echo other/a.txt; echo other/b.txt; } >expect &&
+ test_cmp expect actual
test_expect_success 'git mv should not change sha1 of moved cache entry' '
rm -fr .git &&