Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/http.c
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2021-11-26 01:52:18 +0300
committerJunio C Hamano <gitster@pobox.com>2021-11-26 09:15:07 +0300
commit6def0ff8785eb12ccc24ceebea04355e13ae24b6 (patch)
tree6f2b0e8787a3bf0e6aac8f7d8309b5d41738c65b /http.c
parentc8a4cd55d915a51e666863e576bb1cc2adbecabe (diff)
run-command API users: use strvec_pushv(), not argv assignment
Migrate those run-command API users that assign directly to the "argv" member to use a strvec_pushv() of "args" instead. In these cases it did not make sense to further refactor these callers, e.g. daemon.c could be made to construct the arguments closer to handle(), but that would require moving the construction from its cmd_main() and pass "argv" through two intermediate functions. It would be possible for a change like this to introduce a regression if we were doing: cp.argv = argv; argv[1] = "foo"; And changed the code, as is being done here, to: strvec_pushv(&cp.args, argv); argv[1] = "foo"; But as viewing this change with the "-W" flag reveals none of these functions modify variable that's being pushed afterwards in a way that would introduce such a logic error. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'http.c')
-rw-r--r--http.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/http.c b/http.c
index f92859f43f..229da4d148 100644
--- a/http.c
+++ b/http.c
@@ -2126,8 +2126,9 @@ int finish_http_pack_request(struct http_pack_request *preq)
ip.git_cmd = 1;
ip.in = tmpfile_fd;
- ip.argv = preq->index_pack_args ? preq->index_pack_args
- : default_index_pack_args;
+ strvec_pushv(&ip.args, preq->index_pack_args ?
+ preq->index_pack_args :
+ default_index_pack_args);
if (preq->preserve_index_pack_stdout)
ip.out = 0;