Merge branch 'rs/use-argv-array-in-child-process'
Code cleanup. * rs/use-argv-array-in-child-process: send-pack: use internal argv_array of struct child_process http: use internal argv_array of struct child_processmaint
commit
0956eaa621
11
http.c
11
http.c
|
@ -2030,7 +2030,6 @@ int finish_http_pack_request(struct http_pack_request *preq)
|
||||||
char *tmp_idx;
|
char *tmp_idx;
|
||||||
size_t len;
|
size_t len;
|
||||||
struct child_process ip = CHILD_PROCESS_INIT;
|
struct child_process ip = CHILD_PROCESS_INIT;
|
||||||
const char *ip_argv[8];
|
|
||||||
|
|
||||||
close_pack_index(p);
|
close_pack_index(p);
|
||||||
|
|
||||||
|
@ -2046,13 +2045,9 @@ int finish_http_pack_request(struct http_pack_request *preq)
|
||||||
die("BUG: pack tmpfile does not end in .pack.temp?");
|
die("BUG: pack tmpfile does not end in .pack.temp?");
|
||||||
tmp_idx = xstrfmt("%.*s.idx.temp", (int)len, preq->tmpfile);
|
tmp_idx = xstrfmt("%.*s.idx.temp", (int)len, preq->tmpfile);
|
||||||
|
|
||||||
ip_argv[0] = "index-pack";
|
argv_array_push(&ip.args, "index-pack");
|
||||||
ip_argv[1] = "-o";
|
argv_array_pushl(&ip.args, "-o", tmp_idx, NULL);
|
||||||
ip_argv[2] = tmp_idx;
|
argv_array_push(&ip.args, preq->tmpfile);
|
||||||
ip_argv[3] = preq->tmpfile;
|
|
||||||
ip_argv[4] = NULL;
|
|
||||||
|
|
||||||
ip.argv = ip_argv;
|
|
||||||
ip.git_cmd = 1;
|
ip.git_cmd = 1;
|
||||||
ip.no_stdin = 1;
|
ip.no_stdin = 1;
|
||||||
ip.no_stdout = 1;
|
ip.no_stdout = 1;
|
||||||
|
|
28
send-pack.c
28
send-pack.c
|
@ -58,35 +58,25 @@ static int pack_objects(int fd, struct ref *refs, struct oid_array *extra, struc
|
||||||
* the revision parameters to it via its stdin and
|
* the revision parameters to it via its stdin and
|
||||||
* let its stdout go back to the other end.
|
* let its stdout go back to the other end.
|
||||||
*/
|
*/
|
||||||
const char *argv[] = {
|
|
||||||
"pack-objects",
|
|
||||||
"--all-progress-implied",
|
|
||||||
"--revs",
|
|
||||||
"--stdout",
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
};
|
|
||||||
struct child_process po = CHILD_PROCESS_INIT;
|
struct child_process po = CHILD_PROCESS_INIT;
|
||||||
FILE *po_in;
|
FILE *po_in;
|
||||||
int i;
|
int i;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
i = 4;
|
argv_array_push(&po.args, "pack-objects");
|
||||||
|
argv_array_push(&po.args, "--all-progress-implied");
|
||||||
|
argv_array_push(&po.args, "--revs");
|
||||||
|
argv_array_push(&po.args, "--stdout");
|
||||||
if (args->use_thin_pack)
|
if (args->use_thin_pack)
|
||||||
argv[i++] = "--thin";
|
argv_array_push(&po.args, "--thin");
|
||||||
if (args->use_ofs_delta)
|
if (args->use_ofs_delta)
|
||||||
argv[i++] = "--delta-base-offset";
|
argv_array_push(&po.args, "--delta-base-offset");
|
||||||
if (args->quiet || !args->progress)
|
if (args->quiet || !args->progress)
|
||||||
argv[i++] = "-q";
|
argv_array_push(&po.args, "-q");
|
||||||
if (args->progress)
|
if (args->progress)
|
||||||
argv[i++] = "--progress";
|
argv_array_push(&po.args, "--progress");
|
||||||
if (is_repository_shallow())
|
if (is_repository_shallow())
|
||||||
argv[i++] = "--shallow";
|
argv_array_push(&po.args, "--shallow");
|
||||||
po.argv = argv;
|
|
||||||
po.in = -1;
|
po.in = -1;
|
||||||
po.out = args->stateless_rpc ? -1 : fd;
|
po.out = args->stateless_rpc ? -1 : fd;
|
||||||
po.git_cmd = 1;
|
po.git_cmd = 1;
|
||||||
|
|
Loading…
Reference in New Issue