Merge branch 'pb/maint-1.6.2-userdiff-fix' into maint
authorJunio C Hamano <gitster@pobox.com>
Mon, 22 Jun 2009 04:08:05 +0000 (21:08 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 22 Jun 2009 04:08:05 +0000 (21:08 -0700)
* pb/maint-1.6.2-userdiff-fix:
upload-archive: fix infinite loop on Cygwin
avoid exponential regex match for java and objc function names

1  2 
builtin-upload-archive.c
diff --combined builtin-upload-archive.c
index 0206b416cbf08ae4c1b0d753784fb0b61bac46a1,f6c4c0f149801c2d423f7ed1740a6fe9b03cf8df..c4cd1e1327f18ae27b74fac6dfd41938cd9dfe5d
@@@ -35,7 -35,7 +35,7 @@@ static int run_upload_archive(int argc
        strcpy(buf, argv[1]); /* enter-repo smudges its argument */
  
        if (!enter_repo(buf, 0))
 -              die("not a git archive");
 +              die("'%s' does not appear to be a git repository", buf);
  
        /* put received options in sent_argv[] */
        sent_argc = 1;
@@@ -80,16 -80,17 +80,17 @@@ static void error_clnt(const char *fmt
        die("sent error to the client: %s", buf);
  }
  
- static void process_input(int child_fd, int band)
+ static ssize_t process_input(int child_fd, int band)
  {
        char buf[16384];
        ssize_t sz = read(child_fd, buf, sizeof(buf));
        if (sz < 0) {
                if (errno != EAGAIN && errno != EINTR)
                        error_clnt("read error: %s\n", strerror(errno));
-               return;
+               return sz;
        }
        send_sideband(1, band, buf, sz, LARGE_PACKET_MAX);
+       return sz;
  }
  
  int cmd_upload_archive(int argc, const char **argv, const char *prefix)
  
        while (1) {
                struct pollfd pfd[2];
+               ssize_t processed[2] = { 0, 0 };
                int status;
  
                pfd[0].fd = fd1[0];
                }
                if (pfd[0].revents & POLLIN)
                        /* Data stream ready */
-                       process_input(pfd[0].fd, 1);
+                       processed[0] = process_input(pfd[0].fd, 1);
                if (pfd[1].revents & POLLIN)
                        /* Status stream ready */
-                       process_input(pfd[1].fd, 2);
+                       processed[1] = process_input(pfd[1].fd, 2);
                /* Always finish to read data when available */
-               if ((pfd[0].revents | pfd[1].revents) & POLLIN)
+               if (processed[0] || processed[1])
                        continue;
  
                if (waitpid(writer, &status, 0) < 0)