Skip to content

Commit e073544

Browse files
committed
Merge branch 'mp/upload-pack-use-embedded-args' into maint
The embedded args argv-array in the child process is used to build the command line to run pack-objects instead of using a separate array of strings. * mp/upload-pack-use-embedded-args: upload-pack: use argv_array for pack_objects
2 parents 2bbaad8 + 65a3629 commit e073544

1 file changed

Lines changed: 11 additions & 14 deletions

File tree

upload-pack.c

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -90,35 +90,32 @@ static void create_pack_file(void)
9090
"corruption on the remote side.";
9191
int buffered = -1;
9292
ssize_t sz;
93-
const char *argv[13];
94-
int i, arg = 0;
93+
int i;
9594
FILE *pipe_fd;
9695

9796
if (shallow_nr) {
98-
argv[arg++] = "--shallow-file";
99-
argv[arg++] = "";
97+
argv_array_push(&pack_objects.args, "--shallow-file");
98+
argv_array_push(&pack_objects.args, "");
10099
}
101-
argv[arg++] = "pack-objects";
102-
argv[arg++] = "--revs";
100+
argv_array_push(&pack_objects.args, "pack-objects");
101+
argv_array_push(&pack_objects.args, "--revs");
103102
if (use_thin_pack)
104-
argv[arg++] = "--thin";
103+
argv_array_push(&pack_objects.args, "--thin");
105104

106-
argv[arg++] = "--stdout";
105+
argv_array_push(&pack_objects.args, "--stdout");
107106
if (shallow_nr)
108-
argv[arg++] = "--shallow";
107+
argv_array_push(&pack_objects.args, "--shallow");
109108
if (!no_progress)
110-
argv[arg++] = "--progress";
109+
argv_array_push(&pack_objects.args, "--progress");
111110
if (use_ofs_delta)
112-
argv[arg++] = "--delta-base-offset";
111+
argv_array_push(&pack_objects.args, "--delta-base-offset");
113112
if (use_include_tag)
114-
argv[arg++] = "--include-tag";
115-
argv[arg++] = NULL;
113+
argv_array_push(&pack_objects.args, "--include-tag");
116114

117115
pack_objects.in = -1;
118116
pack_objects.out = -1;
119117
pack_objects.err = -1;
120118
pack_objects.git_cmd = 1;
121-
pack_objects.argv = argv;
122119

123120
if (start_command(&pack_objects))
124121
die("git upload-pack: unable to fork git-pack-objects");

0 commit comments

Comments
 (0)