Merge branch 'jc/upload-corrupt'
authorJunio C Hamano <junkio@cox.net>
Thu, 22 Jun 2006 17:25:51 +0000 (10:25 -0700)
committerJunio C Hamano <junkio@cox.net>
Thu, 22 Jun 2006 17:25:51 +0000 (10:25 -0700)
* 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

1  2 
Makefile
daemon.c
pack-objects.c
pkt-line.c
diff --combined Makefile
index d45f3dcf6214f8a60f3e636d1c5067d273551f0c,ae5e8d790a8b148b95cfce03afab94e97315110a..69b5500f3fd5b42d92e981e0add0dae2264fdf16
+++ 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 a19b7b5aaad228396f08b00c9925c555859393b4,0747ce2a37ac90cd89044ab9e5aac688f0e1a269..1ba4d669da346abb5dab86ea7842a7ad4d3e1cde
+++ 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];
  
                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 ba6525d1f4786dad167994bf7a635c13b2b08ef6,7a8c16c317dc42217ab01da8b130b815ad81846d..bed2497b7974bed96a6ac9478807059cb8de17cb
@@@ -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 44d42969e558cf85aca41cf29604dcfda4ebaf7e,3d724acf23fab5e8a8e3dd5b1dce957ea1d4a9d3..c1e81f976f26726db2432f72f7356087a6e3a7d8
   * 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)