Skip to content

Commit

Permalink
fetch-pack.c: show correct command name that fails
Browse files Browse the repository at this point in the history
When --shallow-file is added to the command line, it has to be
before the subcommand name, the first argument won't be the command
name any more. Stop assuming that and keep track of the command name
explicitly.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Nguyễn Thái Ngọc Duy authored and Junio C Hamano committed Sep 18, 2013
1 parent 6035d6a commit 4727f67
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions fetch-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ static int get_pack(struct fetch_pack_args *args,
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;

Expand Down Expand Up @@ -734,7 +734,7 @@ static int get_pack(struct fetch_pack_args *args,
if (do_keep) {
if (pack_lockfile)
cmd.out = -1;
*av++ = "index-pack";
*av++ = cmd_name = "index-pack";
*av++ = "--stdin";
if (!args->quiet && !args->no_progress)
*av++ = "-v";
Expand All @@ -749,7 +749,7 @@ static int get_pack(struct fetch_pack_args *args,
}
}
else {
*av++ = "unpack-objects";
*av++ = cmd_name = "unpack-objects";
if (args->quiet || args->no_progress)
*av++ = "-q";
}
Expand All @@ -766,14 +766,14 @@ static int get_pack(struct fetch_pack_args *args,
cmd.in = demux.out;
cmd.git_cmd = 1;
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) {
*pack_lockfile = index_pack_lockfile(cmd.out);
close(cmd.out);
}

if (finish_command(&cmd))
die("%s failed", argv[0]);
die("%s failed", cmd_name);
if (use_sideband && finish_async(&demux))
die("error in sideband demultiplexer");
return 0;
Expand Down

0 comments on commit 4727f67

Please sign in to comment.