Merge branch 'jk/push-deadlock-regression-fix' into maint
authorJunio C Hamano <gitster@pobox.com>
Fri, 24 Mar 2017 19:57:52 +0000 (12:57 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 24 Mar 2017 19:57:52 +0000 (12:57 -0700)
"git push" had a handful of codepaths that could lead to a deadlock
when unexpected error happened, which has been fixed.

* jk/push-deadlock-regression-fix:
send-pack: report signal death of pack-objects
send-pack: read "unpack" status even on pack-objects failure
send-pack: improve unpack-status error messages
send-pack: use skip_prefix for parsing unpack status
send-pack: extract parsing of "unpack" response
receive-pack: fix deadlock when we cannot create tmpdir

1  2 
builtin/receive-pack.c
diff --combined builtin/receive-pack.c
index 1dbb8a069225be1e9d9fe27ad4b83a8bd66ca511,eb6d25a14951426c1a0ad00dafe3b228739391cb..8672825e2e57fc0d17dcc65bbf482fb1d476684f
@@@ -795,8 -795,8 +795,8 @@@ static char *refuse_unconfigured_deny_m
           "with what you pushed, and will require 'git reset --hard' to match\n"
           "the work tree to HEAD.\n"
           "\n"
 -         "You can set 'receive.denyCurrentBranch' configuration variable to\n"
 -         "'ignore' or 'warn' in the remote repository to allow pushing into\n"
 +         "You can set the 'receive.denyCurrentBranch' configuration variable\n"
 +         "to 'ignore' or 'warn' in the remote repository to allow pushing into\n"
           "its current branch; however, this is not recommended unless you\n"
           "arranged to update its work tree to match what you pushed in some\n"
           "other way.\n"
@@@ -1664,8 -1664,11 +1664,11 @@@ static const char *unpack(int err_fd, s
        }
  
        tmp_objdir = tmp_objdir_create();
-       if (!tmp_objdir)
+       if (!tmp_objdir) {
+               if (err_fd > 0)
+                       close(err_fd);
                return "unable to create temporary object directory";
+       }
        child.env = tmp_objdir_env(tmp_objdir);
  
        /*
@@@ -1942,7 -1945,8 +1945,7 @@@ int cmd_receive_pack(int argc, const ch
                run_receive_hook(commands, "post-receive", 1,
                                 &push_options);
                run_update_post_hook(commands);
 -              if (push_options.nr)
 -                      string_list_clear(&push_options, 0);
 +              string_list_clear(&push_options, 0);
                if (auto_gc) {
                        const char *argv_gc_auto[] = {
                                "gc", "--auto", "--quiet", NULL,