Merge branch 'nd/fetch-pack-error-reporting-fix'
authorJonathan Nieder <jrnieder@gmail.com>
Wed, 25 Sep 2013 06:27:02 +0000 (24 23:27 -0700)
committerJonathan Nieder <jrnieder@gmail.com>
Wed, 25 Sep 2013 06:27:02 +0000 (24 23:27 -0700)
* nd/fetch-pack-error-reporting-fix:
  fetch-pack.c: show correct command name that fails

1  2 
fetch-pack.c

diff --cc fetch-pack.c
@@@ -659,10 -688,9 +659,10 @@@ static int get_pack(struct fetch_pack_a
        const char *argv[22];
        char keep_arg[256];
        char hdr_arg[256];
-       const char **av;
+       const char **av, *cmd_name;
        int do_keep = args->keep_pack;
        struct child_process cmd;
 +      int ret;
  
        memset(&demux, 0, sizeof(demux));
        if (use_sideband) {
                                strcpy(keep_arg + s, "localhost");
                        *av++ = keep_arg;
                }
 +              if (args->check_self_contained_and_connected)
 +                      *av++ = "--check-self-contained-and-connected";
        }
        else {
-               *av++ = "unpack-objects";
+               *av++ = cmd_name = "unpack-objects";
                if (args->quiet || args->no_progress)
                        *av++ = "-q";
 +              args->check_self_contained_and_connected = 0;
        }
        if (*hdr_arg)
                *av++ = hdr_arg;
                close(cmd.out);
        }
  
 -      if (finish_command(&cmd))
 +      ret = finish_command(&cmd);
 +      if (!ret || (args->check_self_contained_and_connected && ret == 1))
 +              args->self_contained_and_connected =
 +                      args->check_self_contained_and_connected &&
 +                      ret == 0;
 +      else
-               die("%s failed", argv[0]);
+               die("%s failed", cmd_name);
        if (use_sideband && finish_async(&demux))
                die("error in sideband demultiplexer");
        return 0;