diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2013-09-18 20:41:18 +0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-09-18 11:11:53 -0700 |
commit | 4727f671b834a565343ed1af613654ba4d6ececc (patch) | |
tree | a982250efcf42f7dd78a73d7dc595a96fff2f40d | |
parent | 6035d6aad8ca11954c0d7821f6f3e7c047039c8f (diff) | |
download | git-4727f671b834a565343ed1af613654ba4d6ececc.tar.gz |
fetch-pack.c: show correct command name that failsnd/fetch-pack-error-reporting-fix
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>
-rw-r--r-- | fetch-pack.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/fetch-pack.c b/fetch-pack.c index 6b5467c6de..5546a8ca67 100644 --- a/fetch-pack.c +++ b/fetch-pack.c @@ -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; @@ -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"; @@ -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"; } @@ -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; |