Skip to content

Commit 4727f67

Browse files
pcloudsgitster
authored andcommitted
fetch-pack.c: show correct command name that fails
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6035d6a commit 4727f67

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

fetch-pack.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ static int get_pack(struct fetch_pack_args *args,
688688
const char *argv[22];
689689
char keep_arg[256];
690690
char hdr_arg[256];
691-
const char **av;
691+
const char **av, *cmd_name;
692692
int do_keep = args->keep_pack;
693693
struct child_process cmd;
694694

@@ -734,7 +734,7 @@ static int get_pack(struct fetch_pack_args *args,
734734
if (do_keep) {
735735
if (pack_lockfile)
736736
cmd.out = -1;
737-
*av++ = "index-pack";
737+
*av++ = cmd_name = "index-pack";
738738
*av++ = "--stdin";
739739
if (!args->quiet && !args->no_progress)
740740
*av++ = "-v";
@@ -749,7 +749,7 @@ static int get_pack(struct fetch_pack_args *args,
749749
}
750750
}
751751
else {
752-
*av++ = "unpack-objects";
752+
*av++ = cmd_name = "unpack-objects";
753753
if (args->quiet || args->no_progress)
754754
*av++ = "-q";
755755
}
@@ -766,14 +766,14 @@ static int get_pack(struct fetch_pack_args *args,
766766
cmd.in = demux.out;
767767
cmd.git_cmd = 1;
768768
if (start_command(&cmd))
769-
die("fetch-pack: unable to fork off %s", argv[0]);
769+
die("fetch-pack: unable to fork off %s", cmd_name);
770770
if (do_keep && pack_lockfile) {
771771
*pack_lockfile = index_pack_lockfile(cmd.out);
772772
close(cmd.out);
773773
}
774774

775775
if (finish_command(&cmd))
776-
die("%s failed", argv[0]);
776+
die("%s failed", cmd_name);
777777
if (use_sideband && finish_async(&demux))
778778
die("error in sideband demultiplexer");
779779
return 0;

0 commit comments

Comments
 (0)