summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-08-15 21:15:32 -0700
committerJunio C Hamano <junkio@cox.net>2006-08-15 21:15:32 -0700
commitc9c3470aec3a1d753ac1e5f21358f6374c1add95 (patch)
tree32cfcecc5dfb4491eb054d9576f0db50fe058bbf
parent6f002f984f1d1ddfdae990582a423dc5263697ae (diff)
parent53e1a761be8d338cd957870bc1e48a8c15d7d2c0 (diff)
downloadgit-c9c3470aec3a1d753ac1e5f21358f6374c1add95.tar.gz
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
-rw-r--r--Makefile2
-rw-r--r--builtin-mv.c5
-rw-r--r--connect.c11
-rwxr-xr-xt/t7001-mv.sh4
4 files changed, 13 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index b86de761ff..399d2333d0 100644
--- a/Makefile
+++ b/Makefile
@@ -331,10 +331,12 @@ ifeq ($(uname_S),SunOS)
NEEDS_LIBICONV = YesPlease
NO_UNSETENV = YesPlease
NO_SETENV = YesPlease
+ NO_C99_FORMAT = YesPlease
endif
ifeq ($(uname_R),5.9)
NO_UNSETENV = YesPlease
NO_SETENV = YesPlease
+ NO_C99_FORMAT = YesPlease
endif
INSTALL = ginstall
TAR = gtar
diff --git a/builtin-mv.c b/builtin-mv.c
index a731f8d9cf..e7b5eb7088 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)
diff --git a/connect.c b/connect.c
index 4422a0d8d3..b9c222085e 100644
--- a/connect.c
+++ b/connect.c
@@ -737,14 +737,9 @@ int git_connect(int fd[2], char *url, const char *prog)
int finish_connect(pid_t pid)
{
- int ret;
-
- for (;;) {
- ret = waitpid(pid, NULL, 0);
- if (!ret)
- break;
+ while (waitpid(pid, NULL, 0) < 0) {
if (errno != EINTR)
- break;
+ return -1;
}
- return ret;
+ return 0;
}
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 900ca93cde..e5e0bb9d51 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -60,6 +60,10 @@ test_expect_success \
grep -E "^R100.+path0/README.+path2/README"'
test_expect_success \
+ 'succeed when source is a prefix of destination' \
+ 'git-mv path2/COPYING path2/COPYING-renamed'
+
+test_expect_success \
'moving whole subdirectory into subdirectory' \
'git-mv path2 path1'