Merge branch 'nd/fetch-pack-error-reporting-fix'

* nd/fetch-pack-error-reporting-fix:
  fetch-pack.c: show correct command name that fails
This commit is contained in:
Jonathan Nieder
2013-09-24 23:27:02 -07:00

View File

@ -659,7 +659,7 @@ static int get_pack(struct fetch_pack_args *args,
const char *argv[22]; const char *argv[22];
char keep_arg[256]; char keep_arg[256];
char hdr_arg[256]; char hdr_arg[256];
const char **av; const char **av, *cmd_name;
int do_keep = args->keep_pack; int do_keep = args->keep_pack;
struct child_process cmd; struct child_process cmd;
int ret; int ret;
@ -706,7 +706,7 @@ static int get_pack(struct fetch_pack_args *args,
if (do_keep) { if (do_keep) {
if (pack_lockfile) if (pack_lockfile)
cmd.out = -1; cmd.out = -1;
*av++ = "index-pack"; *av++ = cmd_name = "index-pack";
*av++ = "--stdin"; *av++ = "--stdin";
if (!args->quiet && !args->no_progress) if (!args->quiet && !args->no_progress)
*av++ = "-v"; *av++ = "-v";
@ -723,7 +723,7 @@ static int get_pack(struct fetch_pack_args *args,
*av++ = "--check-self-contained-and-connected"; *av++ = "--check-self-contained-and-connected";
} }
else { else {
*av++ = "unpack-objects"; *av++ = cmd_name = "unpack-objects";
if (args->quiet || args->no_progress) if (args->quiet || args->no_progress)
*av++ = "-q"; *av++ = "-q";
args->check_self_contained_and_connected = 0; args->check_self_contained_and_connected = 0;
@ -741,7 +741,7 @@ static int get_pack(struct fetch_pack_args *args,
cmd.in = demux.out; cmd.in = demux.out;
cmd.git_cmd = 1; cmd.git_cmd = 1;
if (start_command(&cmd)) if (start_command(&cmd))
die("fetch-pack: unable to fork off %s", argv[0]); die("fetch-pack: unable to fork off %s", cmd_name);
if (do_keep && pack_lockfile) { if (do_keep && pack_lockfile) {
*pack_lockfile = index_pack_lockfile(cmd.out); *pack_lockfile = index_pack_lockfile(cmd.out);
close(cmd.out); close(cmd.out);
@ -753,7 +753,7 @@ static int get_pack(struct fetch_pack_args *args,
args->check_self_contained_and_connected && args->check_self_contained_and_connected &&
ret == 0; ret == 0;
else else
die("%s failed", argv[0]); die("%s failed", cmd_name);
if (use_sideband && finish_async(&demux)) if (use_sideband && finish_async(&demux))
die("error in sideband demultiplexer"); die("error in sideband demultiplexer");
return 0; return 0;