summaryrefslogtreecommitdiff
path: root/upload-pack.c
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2021-11-25 22:52:20 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-11-26 06:15:07 (GMT)
commit2b7098936c9e91d527aa53b8d4af0b25d7e912b4 (patch)
treed0042309f280e1246533b9bd0bcc70d5ff6ebbbc /upload-pack.c
parent87ee87dd6bb633cd5171e244fb69cd4b66d294aa (diff)
downloadgit-2b7098936c9e91d527aa53b8d4af0b25d7e912b4.zip
git-2b7098936c9e91d527aa53b8d4af0b25d7e912b4.tar.gz
git-2b7098936c9e91d527aa53b8d4af0b25d7e912b4.tar.bz2
run-command API users: use strvec_pushl(), not argv construction
Change a pattern of hardcoding an "argv" array size, populating it and assigning to the "argv" member of "struct child_process" to instead use "strvec_pushl()" to add data to the "args" member. This implements the same behavior as before in fewer lines of code, and moves us further towards being able to remove the "argv" member in a subsequent commit. Since we've entirely removed the "argv" variable(s) we can be sure that no potential logic errors of the type discussed in a preceding commit are being introduced here, i.e. ones where the local "argv" was being modified after the assignment to "struct child_process"'s "argv". Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'upload-pack.c')
-rw-r--r--upload-pack.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/upload-pack.c b/upload-pack.c
index c78d55b..9b5db32 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -596,14 +596,11 @@ static int do_reachable_revlist(struct child_process *cmd,
struct object_array *reachable,
enum allow_uor allow_uor)
{
- static const char *argv[] = {
- "rev-list", "--stdin", NULL,
- };
struct object *o;
FILE *cmd_in = NULL;
int i;
- cmd->argv = argv;
+ strvec_pushl(&cmd->args, "rev-list", "--stdin", NULL);
cmd->git_cmd = 1;
cmd->no_stderr = 1;
cmd->in = -1;