Skip to content

Commit

Permalink
Merge branch 'maint'
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Junio C Hamano committed Aug 16, 2006
2 parents 6f002f9 + 53e1a76 commit c9c3470
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion builtin-mv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
11 changes: 3 additions & 8 deletions connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
4 changes: 4 additions & 0 deletions t/t7001-mv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit c9c3470

Please sign in to comment.