From: Junio C Hamano Date: Thu, 22 Jun 2006 17:25:51 +0000 (-0700) Subject: Merge branch 'jc/upload-corrupt' X-Git-Tag: v1.4.1-rc1^2~4 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/16bf4e1f1ed040ae9f745408d6585b7806a1bfb0?ds=inline;hp=-c Merge branch 'jc/upload-corrupt' * jc/upload-corrupt: daemon: send stderr to /dev/null instead of closing. upload-pack/fetch-pack: support side-band communication Retire git-clone-pack upload-pack: prepare for sideband message support. upload-pack: avoid sending an incomplete pack upon failure --- 16bf4e1f1ed040ae9f745408d6585b7806a1bfb0 diff --combined Makefile index d45f3dcf62,ae5e8d790a..69b5500f3f --- a/Makefile +++ b/Makefile @@@ -149,7 -149,7 +149,7 @@@ SIMPLE_PROGRAMS = # ... and all the rest that could be moved out of bindir to gitexecdir PROGRAMS = \ - git-checkout-index$X git-clone-pack$X \ + git-checkout-index$X \ git-convert-objects$X git-fetch-pack$X git-fsck-objects$X \ git-hash-object$X git-index-pack$X git-local-fetch$X \ git-mailinfo$X git-merge-base$X \ @@@ -472,6 -472,7 +472,6 @@@ PYTHON_PATH_SQ = $(subst ','\'',$(PYTHO GIT_PYTHON_DIR_SQ = $(subst ','\'',$(GIT_PYTHON_DIR)) ALL_CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER_SQ)' $(COMPAT_CFLAGS) -ALL_CFLAGS += -DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir_SQ)"' LIB_OBJS += $(COMPAT_OBJS) export prefix TAR INSTALL DESTDIR SHELL_PATH template_dir ### Build rules @@@ -547,8 -548,6 +547,8 @@@ git$X git.spec exec_cmd.o: exec_cmd.c GIT-CFLAGS $(CC) -o $*.o -c $(ALL_CFLAGS) '-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' $< +builtin-init-db.o: builtin-init-db.c GIT-CFLAGS + $(CC) -o $*.o -c $(ALL_CFLAGS) -DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir_SQ)"' $< http.o: http.c GIT-CFLAGS $(CC) -o $*.o -c $(ALL_CFLAGS) -DGIT_USER_AGENT='"git/$(GIT_VERSION)"' $< @@@ -612,7 -611,7 +612,7 @@@ tags find . -name '*.[hcS]' -print | xargs ctags -a ### Detect prefix changes -TRACK_CFLAGS = $(subst ','\'',$(ALL_CFLAGS)):$(GIT_VERSION):\ +TRACK_CFLAGS = $(subst ','\'',$(ALL_CFLAGS)):$(GIT_PYTHON_DIR_SQ):\ $(bindir_SQ):$(gitexecdir_SQ):$(template_dir_SQ):$(prefix_SQ) GIT-CFLAGS: .FORCE-GIT-CFLAGS diff --combined daemon.c index a19b7b5aaa,0747ce2a37..1ba4d669da --- a/daemon.c +++ b/daemon.c @@@ -673,11 -673,6 +673,11 @@@ int main(int argc, char **argv int inetd_mode = 0; int i; + /* Without this we cannot rely on waitpid() to tell + * what happened to our children. + */ + signal(SIGCHLD, SIG_DFL); + for (i = 1; i < argc; i++) { char *arg = argv[i]; @@@ -762,7 -757,7 +762,7 @@@ struct sockaddr *peer = (struct sockaddr *)&ss; socklen_t slen = sizeof(ss); - fclose(stderr); //FIXME: workaround + freopen("/dev/null", "w", stderr); if (getpeername(0, peer, &slen)) peer = NULL; diff --combined pack-objects.c index ba6525d1f4,7a8c16c317..bed2497b79 --- a/pack-objects.c +++ b/pack-objects.c @@@ -156,7 -156,7 +156,7 @@@ static void prepare_pack_revindex(struc rix->revindex = xmalloc(sizeof(unsigned long) * (num_ent + 1)); for (i = 0; i < num_ent; i++) { - unsigned int hl = *((unsigned int *)(index + 24 * i)); + unsigned int hl = *((unsigned int *)((char *) index + 24*i)); rix->revindex[i] = ntohl(hl); } /* This knows the pack format -- the 20-byte trailer @@@ -300,7 -300,7 +300,7 @@@ static unsigned long write_object(struc use_packed_git(p); datalen = find_packed_object_size(p, entry->in_pack_offset); - buf = p->pack_base + entry->in_pack_offset; + buf = (char *) p->pack_base + entry->in_pack_offset; sha1write(f, buf, datalen); unuse_packed_git(p); hdrlen = 0; /* not really */ @@@ -1221,6 -1221,10 +1221,10 @@@ int main(int argc, char **argv local = 1; continue; } + if (!strcmp("--progress", arg)) { + progress = 1; + continue; + } if (!strcmp("--incremental", arg)) { incremental = 1; continue; diff --combined pkt-line.c index 44d42969e5,3d724acf23..c1e81f976f --- a/pkt-line.c +++ b/pkt-line.c @@@ -16,12 -16,13 +16,13 @@@ * The writing side could use stdio, but since the reading * side can't, we stay with pure read/write interfaces. */ - static void safe_write(int fd, const void *buf, unsigned n) + ssize_t safe_write(int fd, const void *buf, ssize_t n) { + ssize_t nn = n; while (n) { int ret = xwrite(fd, buf, n); if (ret > 0) { - buf += ret; + buf = (char *) buf + ret; n -= ret; continue; } @@@ -29,6 -30,7 +30,7 @@@ die("write error (disk full?)"); die("write error (%s)", strerror(errno)); } + return nn; } /* @@@ -66,7 -68,7 +68,7 @@@ static void safe_read(int fd, void *buf int n = 0; while (n < size) { - int ret = xread(fd, buffer + n, size - n); + int ret = xread(fd, (char *) buffer + n, size - n); if (ret < 0) die("read error (%s)", strerror(errno)); if (!ret)