summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d78b0f3)
raw | patch | inline | side by side (parent: d78b0f3)
author | Johannes Schindelin <Johannes.Schindelin@gmx.de> | |
Fri, 18 Aug 2006 10:42:39 +0000 (12:42 +0200) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Mon, 21 Aug 2006 21:15:43 +0000 (14:15 -0700) |
Since the normalized basename of "." is "", the check for directory
failed erroneously.
Noticed by Fredrik Kuivinen.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
failed erroneously.
Noticed by Fredrik Kuivinen.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
builtin-mv.c | patch | blob | history | |
t/t7001-mv.sh | patch | blob | history |
diff --git a/builtin-mv.c b/builtin-mv.c
index c0c8764f7fa71ffe459997f03b5158cd7c72209b..b2ecc26f238f9f2a7297164145a19397c124b96f 100644 (file)
--- a/builtin-mv.c
+++ b/builtin-mv.c
modes = xcalloc(count, sizeof(enum update_mode));
dest_path = copy_pathspec(prefix, argv + argc - 1, 1, 0);
- if (!lstat(dest_path[0], &st) &&
+ if (dest_path[0][0] == '\0')
+ /* special case: "." was normalized to "" */
+ destination = copy_pathspec(dest_path[0], argv + i, count, 1);
+ else if (!lstat(dest_path[0], &st) &&
S_ISDIR(st.st_mode)) {
dest_path[0] = add_slash(dest_path[0]);
destination = copy_pathspec(dest_path[0], argv + i, count, 1);
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index e5e0bb9d513016c25956e18230dd4ba21fb2445b..b7fcdb390c588545f2419ab3c825b924fbf96dd2 100755 (executable)
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
'do not move directory over existing directory' \
'mkdir path0 && mkdir path0/path2 && git-mv path2 path0'
+test_expect_success \
+ 'move into "."' \
+ 'git-mv path1/path2/ .'
+
test_done