aboutsummaryrefslogtreecommitdiff
path: root/builtin-mv.c
diff options
context:
space:
mode:
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>2006-08-18 12:42:39 +0200
committerJunio C Hamano <junkio@cox.net>2006-08-21 14:15:43 -0700
commitc5203bdf66531c848a2b6cd74f3c02cb18286c55 (patch)
tree2e020e22ac6714569a4b2493e724224b07a15d42 /builtin-mv.c
parentd78b0f3d6aa04510dd0c22c3853d3954c5f5b531 (diff)
downloadgit-c5203bdf66531c848a2b6cd74f3c02cb18286c55.tar.gz
git-c5203bdf66531c848a2b6cd74f3c02cb18286c55.tar.xz
git-mv: special case destination "."
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>
Diffstat (limited to 'builtin-mv.c')
-rw-r--r--builtin-mv.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/builtin-mv.c b/builtin-mv.c
index c0c8764f7..b2ecc26f2 100644
--- a/builtin-mv.c
+++ b/builtin-mv.c
@@ -114,7 +114,10 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
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);