Merge branch 'maint'
authorJunio C Hamano <junkio@cox.net>
Wed, 16 Aug 2006 04:15:32 +0000 (21:15 -0700)
committerJunio C Hamano <junkio@cox.net>
Wed, 16 Aug 2006 04:15:32 +0000 (21:15 -0700)
* 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

Makefile
builtin-mv.c
connect.c
t/t7001-mv.sh
index b86de761ff20d62578f7e397abaf440a2f576eae..399d2333d004fd6a9424257e6bceb6ae173cb9e1 100644 (file)
--- 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
index a731f8d9cfed783fb59cb64db93f854ef0a4ebf9..e7b5eb7088dc3d45608a7d9b3ebaf1c66501596e 100644 (file)
@@ -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)
index 4422a0d8d38c225c6c4716ce8ff826bc1acbd981..b9c222085ee1390c8f0c02f63304193fa78ce677 100644 (file)
--- 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;
 }
index 900ca93cde02f82c35a59ee99349f9d0c4213867..e5e0bb9d513016c25956e18230dd4ba21fb2445b 100755 (executable)
@@ -59,6 +59,10 @@ test_expect_success \
      git-diff-tree -r -M --name-status  HEAD^ HEAD | \
      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'