summaryrefslogtreecommitdiff
path: root/builtin-mv.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-08-16 04:15:32 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-08-16 04:15:32 (GMT)
commitc9c3470aec3a1d753ac1e5f21358f6374c1add95 (patch)
tree32cfcecc5dfb4491eb054d9576f0db50fe058bbf /builtin-mv.c
parent6f002f984f1d1ddfdae990582a423dc5263697ae (diff)
parent53e1a761be8d338cd957870bc1e48a8c15d7d2c0 (diff)
downloadgit-c9c3470aec3a1d753ac1e5f21358f6374c1add95.zip
git-c9c3470aec3a1d753ac1e5f21358f6374c1add95.tar.gz
git-c9c3470aec3a1d753ac1e5f21358f6374c1add95.tar.bz2
Merge branch 'maint'
* maint: finish_connect(): thinkofix git-mv: succeed even if source is a prefix of destination Solaris does not support C99 format strings before version 10
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 a731f8d..e7b5eb7 100644
--- a/builtin-mv.c
+++ b/builtin-mv.c
@@ -119,6 +119,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
/* Checking */
for (i = 0; i < count; i++) {
+ int length;
const char *bad = NULL;
if (show_only)
@@ -204,7 +205,9 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
}
if (!bad &&
- !strncmp(destination[i], source[i], strlen(source[i])))
+ (length = strlen(source[i])) >= 0 &&
+ !strncmp(destination[i], source[i], length) &&
+ (destination[i][length] == 0 || destination[i][length] == '/'))
bad = "can not move directory into itself";
if (!bad && cache_name_pos(source[i], strlen(source[i])) < 0)