From dbbcd44fb47347a3fdbee88ea21805b7f4ac0b98 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Tue, 28 Jul 2020 16:23:39 -0400 Subject: strvec: rename files from argv-array to strvec This requires updating #include lines across the code-base, but that's all fairly mechanical, and was done with: git ls-files '*.c' '*.h' | xargs perl -i -pe 's/argv-array.h/strvec.h/' Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- refspec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'refspec.c') diff --git a/refspec.c b/refspec.c index 9a9bf21934..f9fb67d295 100644 --- a/refspec.c +++ b/refspec.c @@ -1,5 +1,5 @@ #include "cache.h" -#include "argv-array.h" +#include "strvec.h" #include "refs.h" #include "refspec.h" -- cgit v1.2.3 From c972bf4cf546a56fe1c54ddde1d33ebb9f454a0f Mon Sep 17 00:00:00 2001 From: Jeff King Date: Tue, 28 Jul 2020 16:25:12 -0400 Subject: strvec: convert remaining callers away from argv_array name We eventually want to drop the argv_array name and just use strvec consistently. There's no particular reason we have to do it all at once, or care about interactions between converted and unconverted bits. Because of our preprocessor compat layer, the names are interchangeable to the compiler (so even a definition and declaration using different names is OK). This patch converts all of the remaining files, as the resulting diff is reasonably sized. The conversion was done purely mechanically with: git ls-files '*.c' '*.h' | xargs perl -i -pe ' s/ARGV_ARRAY/STRVEC/g; s/argv_array/strvec/g; ' We'll deal with any indentation/style fallouts separately. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- merge.c | 16 ++-- midx.c | 12 +-- pager.c | 8 +- parse-options-cb.c | 6 +- pathspec.c | 6 +- quote.c | 4 +- range-diff.c | 10 +-- range-diff.h | 2 +- ref-filter.c | 6 +- refs.c | 6 +- refspec.c | 4 +- remote-curl.c | 86 ++++++++++----------- remote-testsvn.c | 8 +- remote.c | 12 +-- revision.c | 14 ++-- run-command.c | 50 ++++++------- run-command.h | 10 +-- send-pack.c | 18 ++--- sequencer.c | 112 ++++++++++++++-------------- serve.c | 12 +-- sha1-file.c | 14 ++-- sub-process.c | 2 +- submodule.c | 178 ++++++++++++++++++++++---------------------- t/helper/test-run-command.c | 36 ++++----- tmp-objdir.c | 16 ++-- transport-helper.c | 30 ++++---- transport-internal.h | 2 +- transport.c | 12 +-- transport.h | 2 +- unpack-trees.c | 10 +-- unpack-trees.h | 2 +- upload-pack.c | 48 ++++++------ wt-status.c | 16 ++-- 33 files changed, 385 insertions(+), 385 deletions(-) (limited to 'refspec.c') diff --git a/merge.c b/merge.c index aa36de2f64..a05b054faa 100644 --- a/merge.c +++ b/merge.c @@ -19,22 +19,22 @@ int try_merge_command(struct repository *r, const char **xopts, struct commit_list *common, const char *head_arg, struct commit_list *remotes) { - struct argv_array args = ARGV_ARRAY_INIT; + struct strvec args = STRVEC_INIT; int i, ret; struct commit_list *j; - argv_array_pushf(&args, "merge-%s", strategy); + strvec_pushf(&args, "merge-%s", strategy); for (i = 0; i < xopts_nr; i++) - argv_array_pushf(&args, "--%s", xopts[i]); + strvec_pushf(&args, "--%s", xopts[i]); for (j = common; j; j = j->next) - argv_array_push(&args, merge_argument(j->item)); - argv_array_push(&args, "--"); - argv_array_push(&args, head_arg); + strvec_push(&args, merge_argument(j->item)); + strvec_push(&args, "--"); + strvec_push(&args, head_arg); for (j = remotes; j; j = j->next) - argv_array_push(&args, merge_argument(j->item)); + strvec_push(&args, merge_argument(j->item)); ret = run_command_v_opt(args.argv, RUN_GIT_CMD); - argv_array_clear(&args); + strvec_clear(&args); discard_index(r->index); if (repo_read_index(r) < 0) diff --git a/midx.c b/midx.c index 6d1584ca51..a5fb797ede 100644 --- a/midx.c +++ b/midx.c @@ -1408,21 +1408,21 @@ int midx_repack(struct repository *r, const char *object_dir, size_t batch_size, repo_config_get_bool(r, "repack.usedeltabaseoffset", &delta_base_offset); repo_config_get_bool(r, "repack.usedeltaislands", &use_delta_islands); - argv_array_push(&cmd.args, "pack-objects"); + strvec_push(&cmd.args, "pack-objects"); strbuf_addstr(&base_name, object_dir); strbuf_addstr(&base_name, "/pack/pack"); - argv_array_push(&cmd.args, base_name.buf); + strvec_push(&cmd.args, base_name.buf); if (delta_base_offset) - argv_array_push(&cmd.args, "--delta-base-offset"); + strvec_push(&cmd.args, "--delta-base-offset"); if (use_delta_islands) - argv_array_push(&cmd.args, "--delta-islands"); + strvec_push(&cmd.args, "--delta-islands"); if (flags & MIDX_PROGRESS) - argv_array_push(&cmd.args, "--progress"); + strvec_push(&cmd.args, "--progress"); else - argv_array_push(&cmd.args, "-q"); + strvec_push(&cmd.args, "-q"); strbuf_release(&base_name); diff --git a/pager.c b/pager.c index 41446d4f05..ee435de675 100644 --- a/pager.c +++ b/pager.c @@ -68,7 +68,7 @@ const char *git_pager(int stdout_is_tty) return pager; } -static void setup_pager_env(struct argv_array *env) +static void setup_pager_env(struct strvec *env) { const char **argv; int i; @@ -88,7 +88,7 @@ static void setup_pager_env(struct argv_array *env) *cp = '\0'; if (!getenv(argv[i])) { *cp = '='; - argv_array_push(env, argv[i]); + strvec_push(env, argv[i]); } } free(pager_env); @@ -97,7 +97,7 @@ static void setup_pager_env(struct argv_array *env) void prepare_pager_args(struct child_process *pager_process, const char *pager) { - argv_array_push(&pager_process->args, pager); + strvec_push(&pager_process->args, pager); pager_process->use_shell = 1; setup_pager_env(&pager_process->env_array); pager_process->trace2_child_class = "pager"; @@ -126,7 +126,7 @@ void setup_pager(void) /* spawn the pager */ prepare_pager_args(&pager_process, pager); pager_process.in = -1; - argv_array_push(&pager_process.env_array, "GIT_PAGER_IN_USE"); + strvec_push(&pager_process.env_array, "GIT_PAGER_IN_USE"); if (start_command(&pager_process)) return; diff --git a/parse-options-cb.c b/parse-options-cb.c index 7cba96454c..d9d3b0819f 100644 --- a/parse-options-cb.c +++ b/parse-options-cb.c @@ -275,19 +275,19 @@ int parse_opt_passthru(const struct option *opt, const char *arg, int unset) /** * For an option opt, recreate the command-line option, appending it to - * opt->value which must be a argv_array. This is useful when we need to pass + * opt->value which must be a strvec. This is useful when we need to pass * the command-line option, which can be specified multiple times, to another * command. */ int parse_opt_passthru_argv(const struct option *opt, const char *arg, int unset) { static struct strbuf sb = STRBUF_INIT; - struct argv_array *opt_value = opt->value; + struct strvec *opt_value = opt->value; if (recreate_opt(&sb, opt, arg, unset) < 0) return -1; - argv_array_push(opt_value, sb.buf); + strvec_push(opt_value, sb.buf); return 0; } diff --git a/pathspec.c b/pathspec.c index 57c9b58418..c303126f37 100644 --- a/pathspec.c +++ b/pathspec.c @@ -624,7 +624,7 @@ void parse_pathspec_file(struct pathspec *pathspec, unsigned magic_mask, unsigned flags, const char *prefix, const char *file, int nul_term_line) { - struct argv_array parsed_file = ARGV_ARRAY_INIT; + struct strvec parsed_file = STRVEC_INIT; strbuf_getline_fn getline_fn = nul_term_line ? strbuf_getline_nul : strbuf_getline; struct strbuf buf = STRBUF_INIT; @@ -643,7 +643,7 @@ void parse_pathspec_file(struct pathspec *pathspec, unsigned magic_mask, die(_("line is badly quoted: %s"), buf.buf); strbuf_swap(&buf, &unquoted); } - argv_array_push(&parsed_file, buf.buf); + strvec_push(&parsed_file, buf.buf); strbuf_reset(&buf); } @@ -653,7 +653,7 @@ void parse_pathspec_file(struct pathspec *pathspec, unsigned magic_mask, fclose(in); parse_pathspec(pathspec, magic_mask, flags, prefix, parsed_file.argv); - argv_array_clear(&parsed_file); + strvec_clear(&parsed_file); } void copy_pathspec(struct pathspec *dst, const struct pathspec *src) diff --git a/quote.c b/quote.c index 10b383cc1d..ced0245e80 100644 --- a/quote.c +++ b/quote.c @@ -172,7 +172,7 @@ char *sq_dequote(char *arg) static int sq_dequote_to_argv_internal(char *arg, const char ***argv, int *nr, int *alloc, - struct argv_array *array) + struct strvec *array) { char *next = arg; @@ -187,7 +187,7 @@ static int sq_dequote_to_argv_internal(char *arg, (*argv)[(*nr)++] = dequoted; } if (array) - argv_array_push(array, dequoted); + strvec_push(array, dequoted); } while (next); return 0; diff --git a/range-diff.c b/range-diff.c index b4d1d56445..3a0eb70c89 100644 --- a/range-diff.c +++ b/range-diff.c @@ -41,7 +41,7 @@ static size_t find_end_of_line(char *buffer, unsigned long size) * as struct object_id (will need to be free()d). */ static int read_patches(const char *range, struct string_list *list, - const struct argv_array *other_arg) + const struct strvec *other_arg) { struct child_process cp = CHILD_PROCESS_INIT; struct strbuf buf = STRBUF_INIT, contents = STRBUF_INIT; @@ -51,7 +51,7 @@ static int read_patches(const char *range, struct string_list *list, int offset, len; size_t size; - argv_array_pushl(&cp.args, "log", "--no-color", "-p", "--no-merges", + strvec_pushl(&cp.args, "log", "--no-color", "-p", "--no-merges", "--reverse", "--date-order", "--decorate=no", "--no-prefix", /* @@ -67,8 +67,8 @@ static int read_patches(const char *range, struct string_list *list, "--notes", NULL); if (other_arg) - argv_array_pushv(&cp.args, other_arg->argv); - argv_array_push(&cp.args, range); + strvec_pushv(&cp.args, other_arg->argv); + strvec_push(&cp.args, range); cp.out = -1; cp.no_stdin = 1; cp.git_cmd = 1; @@ -523,7 +523,7 @@ static struct strbuf *output_prefix_cb(struct diff_options *opt, void *data) int show_range_diff(const char *range1, const char *range2, int creation_factor, int dual_color, const struct diff_options *diffopt, - const struct argv_array *other_arg) + const struct strvec *other_arg) { int res = 0; diff --git a/range-diff.h b/range-diff.h index 916f18bcd7..583ced2e8e 100644 --- a/range-diff.h +++ b/range-diff.h @@ -14,6 +14,6 @@ int show_range_diff(const char *range1, const char *range2, int creation_factor, int dual_color, const struct diff_options *diffopt, - const struct argv_array *other_arg); + const struct strvec *other_arg); #endif diff --git a/ref-filter.c b/ref-filter.c index 81c4399da9..7f013851ed 100644 --- a/ref-filter.c +++ b/ref-filter.c @@ -1914,15 +1914,15 @@ static void find_longest_prefixes_1(struct string_list *out, static void find_longest_prefixes(struct string_list *out, const char **patterns) { - struct argv_array sorted = ARGV_ARRAY_INIT; + struct strvec sorted = STRVEC_INIT; struct strbuf prefix = STRBUF_INIT; - argv_array_pushv(&sorted, patterns); + strvec_pushv(&sorted, patterns); QSORT(sorted.argv, sorted.argc, qsort_strcmp); find_longest_prefixes_1(out, &prefix, sorted.argv, sorted.argc); - argv_array_clear(&sorted); + strvec_clear(&sorted); strbuf_release(&prefix); } diff --git a/refs.c b/refs.c index 0067926262..d8d3b10fbd 100644 --- a/refs.c +++ b/refs.c @@ -553,13 +553,13 @@ int refname_match(const char *abbrev_name, const char *full_name) * Given a 'prefix' expand it by the rules in 'ref_rev_parse_rules' and add * the results to 'prefixes' */ -void expand_ref_prefix(struct argv_array *prefixes, const char *prefix) +void expand_ref_prefix(struct strvec *prefixes, const char *prefix) { const char **p; int len = strlen(prefix); for (p = ref_rev_parse_rules; *p; p++) - argv_array_pushf(prefixes, *p, len, prefix); + strvec_pushf(prefixes, *p, len, prefix); } char *repo_default_branch_name(struct repository *r) @@ -2037,7 +2037,7 @@ static int run_transaction_hook(struct ref_transaction *transaction, return ret; } - argv_array_pushl(&proc.args, hook, state, NULL); + strvec_pushl(&proc.args, hook, state, NULL); proc.in = -1; proc.stdout_to_stderr = 1; proc.trace2_hook_name = "reference-transaction"; diff --git a/refspec.c b/refspec.c index f9fb67d295..6f317d6b44 100644 --- a/refspec.c +++ b/refspec.c @@ -202,7 +202,7 @@ int valid_fetch_refspec(const char *fetch_refspec_str) } void refspec_ref_prefixes(const struct refspec *rs, - struct argv_array *ref_prefixes) + struct strvec *ref_prefixes) { int i; for (i = 0; i < rs->nr; i++) { @@ -221,7 +221,7 @@ void refspec_ref_prefixes(const struct refspec *rs, if (prefix) { if (item->pattern) { const char *glob = strchr(prefix, '*'); - argv_array_pushf(ref_prefixes, "%.*s", + strvec_pushf(ref_prefixes, "%.*s", (int)(glob - prefix), prefix); } else { diff --git a/remote-curl.c b/remote-curl.c index 05fb794ddd..85ce4f7e6f 100644 --- a/remote-curl.c +++ b/remote-curl.c @@ -1141,41 +1141,41 @@ static int fetch_git(struct discovery *heads, struct rpc_state rpc; struct strbuf preamble = STRBUF_INIT; int i, err; - struct argv_array args = ARGV_ARRAY_INIT; + struct strvec args = STRVEC_INIT; struct strbuf rpc_result = STRBUF_INIT; - argv_array_pushl(&args, "fetch-pack", "--stateless-rpc", + strvec_pushl(&args, "fetch-pack", "--stateless-rpc", "--stdin", "--lock-pack", NULL); if (options.followtags) - argv_array_push(&args, "--include-tag"); + strvec_push(&args, "--include-tag"); if (options.thin) - argv_array_push(&args, "--thin"); + strvec_push(&args, "--thin"); if (options.verbosity >= 3) - argv_array_pushl(&args, "-v", "-v", NULL); + strvec_pushl(&args, "-v", "-v", NULL); if (options.check_self_contained_and_connected) - argv_array_push(&args, "--check-self-contained-and-connected"); + strvec_push(&args, "--check-self-contained-and-connected"); if (options.cloning) - argv_array_push(&args, "--cloning"); + strvec_push(&args, "--cloning"); if (options.update_shallow) - argv_array_push(&args, "--update-shallow"); + strvec_push(&args, "--update-shallow"); if (!options.progress) - argv_array_push(&args, "--no-progress"); + strvec_push(&args, "--no-progress"); if (options.depth) - argv_array_pushf(&args, "--depth=%lu", options.depth); + strvec_pushf(&args, "--depth=%lu", options.depth); if (options.deepen_since) - argv_array_pushf(&args, "--shallow-since=%s", options.deepen_since); + strvec_pushf(&args, "--shallow-since=%s", options.deepen_since); for (i = 0; i < options.deepen_not.nr; i++) - argv_array_pushf(&args, "--shallow-exclude=%s", + strvec_pushf(&args, "--shallow-exclude=%s", options.deepen_not.items[i].string); if (options.deepen_relative && options.depth) - argv_array_push(&args, "--deepen-relative"); + strvec_push(&args, "--deepen-relative"); if (options.from_promisor) - argv_array_push(&args, "--from-promisor"); + strvec_push(&args, "--from-promisor"); if (options.no_dependents) - argv_array_push(&args, "--no-dependents"); + strvec_push(&args, "--no-dependents"); if (options.filter) - argv_array_pushf(&args, "--filter=%s", options.filter); - argv_array_push(&args, url.buf); + strvec_pushf(&args, "--filter=%s", options.filter); + strvec_push(&args, url.buf); for (i = 0; i < nr_heads; i++) { struct ref *ref = to_fetch[i]; @@ -1195,7 +1195,7 @@ static int fetch_git(struct discovery *heads, write_or_die(1, rpc_result.buf, rpc_result.len); strbuf_release(&rpc_result); strbuf_release(&preamble); - argv_array_clear(&args); + strvec_clear(&args); return err; } @@ -1267,15 +1267,15 @@ static int push_dav(int nr_spec, const char **specs) size_t i; child.git_cmd = 1; - argv_array_push(&child.args, "http-push"); - argv_array_push(&child.args, "--helper-status"); + strvec_push(&child.args, "http-push"); + strvec_push(&child.args, "--helper-status"); if (options.dry_run) - argv_array_push(&child.args, "--dry-run"); + strvec_push(&child.args, "--dry-run"); if (options.verbosity > 1) - argv_array_push(&child.args, "--verbose"); - argv_array_push(&child.args, url.buf); + strvec_push(&child.args, "--verbose"); + strvec_push(&child.args, url.buf); for (i = 0; i < nr_spec; i++) - argv_array_push(&child.args, specs[i]); + strvec_push(&child.args, specs[i]); if (run_command(&child)) die(_("git-http-push failed")); @@ -1286,38 +1286,38 @@ static int push_git(struct discovery *heads, int nr_spec, const char **specs) { struct rpc_state rpc; int i, err; - struct argv_array args; + struct strvec args; struct string_list_item *cas_option; struct strbuf preamble = STRBUF_INIT; struct strbuf rpc_result = STRBUF_INIT; - argv_array_init(&args); - argv_array_pushl(&args, "send-pack", "--stateless-rpc", "--helper-status", + strvec_init(&args); + strvec_pushl(&args, "send-pack", "--stateless-rpc", "--helper-status", NULL); if (options.thin) - argv_array_push(&args, "--thin"); + strvec_push(&args, "--thin"); if (options.dry_run) - argv_array_push(&args, "--dry-run"); + strvec_push(&args, "--dry-run"); if (options.push_cert == SEND_PACK_PUSH_CERT_ALWAYS) - argv_array_push(&args, "--signed=yes"); + strvec_push(&args, "--signed=yes"); else if (options.push_cert == SEND_PACK_PUSH_CERT_IF_ASKED) - argv_array_push(&args, "--signed=if-asked"); + strvec_push(&args, "--signed=if-asked"); if (options.atomic) - argv_array_push(&args, "--atomic"); + strvec_push(&args, "--atomic"); if (options.verbosity == 0) - argv_array_push(&args, "--quiet"); + strvec_push(&args, "--quiet"); else if (options.verbosity > 1) - argv_array_push(&args, "--verbose"); + strvec_push(&args, "--verbose"); for (i = 0; i < options.push_options.nr; i++) - argv_array_pushf(&args, "--push-option=%s", + strvec_pushf(&args, "--push-option=%s", options.push_options.items[i].string); - argv_array_push(&args, options.progress ? "--progress" : "--no-progress"); + strvec_push(&args, options.progress ? "--progress" : "--no-progress"); for_each_string_list_item(cas_option, &cas_options) - argv_array_push(&args, cas_option->string); - argv_array_push(&args, url.buf); + strvec_push(&args, cas_option->string); + strvec_push(&args, url.buf); - argv_array_push(&args, "--stdin"); + strvec_push(&args, "--stdin"); for (i = 0; i < nr_spec; i++) packet_buf_write(&preamble, "%s\n", specs[i]); packet_buf_flush(&preamble); @@ -1330,7 +1330,7 @@ static int push_git(struct discovery *heads, int nr_spec, const char **specs) write_or_die(1, rpc_result.buf, rpc_result.len); strbuf_release(&rpc_result); strbuf_release(&preamble); - argv_array_clear(&args); + strvec_clear(&args); return err; } @@ -1349,13 +1349,13 @@ static int push(int nr_spec, const char **specs) static void parse_push(struct strbuf *buf) { - struct argv_array specs = ARGV_ARRAY_INIT; + struct strvec specs = STRVEC_INIT; int ret; do { const char *arg; if (skip_prefix(buf->buf, "push ", &arg)) - argv_array_push(&specs, arg); + strvec_push(&specs, arg); else die(_("http transport does not support %s"), buf->buf); @@ -1374,7 +1374,7 @@ static void parse_push(struct strbuf *buf) exit(128); /* error already reported */ free_specs: - argv_array_clear(&specs); + strvec_clear(&specs); } static int stateless_connect(const char *service_name) diff --git a/remote-testsvn.c b/remote-testsvn.c index 809b290d45..636b2b62a6 100644 --- a/remote-testsvn.c +++ b/remote-testsvn.c @@ -198,10 +198,10 @@ static int cmd_import(const char *line) die_errno("Couldn't open svn dump file %s.", url); } else { svndump_proc.out = -1; - argv_array_push(&svndump_proc.args, command); - argv_array_push(&svndump_proc.args, "dump"); - argv_array_push(&svndump_proc.args, url); - argv_array_pushf(&svndump_proc.args, "-r%u:HEAD", startrev); + strvec_push(&svndump_proc.args, command); + strvec_push(&svndump_proc.args, "dump"); + strvec_push(&svndump_proc.args, url); + strvec_pushf(&svndump_proc.args, "-r%u:HEAD", startrev); code = start_command(&svndump_proc); if (code) diff --git a/remote.c b/remote.c index ba1a386d98..13b097866c 100644 --- a/remote.c +++ b/remote.c @@ -1885,7 +1885,7 @@ static int stat_branch_pair(const char *branch_name, const char *base, struct object_id oid; struct commit *ours, *theirs; struct rev_info revs; - struct argv_array argv = ARGV_ARRAY_INIT; + struct strvec argv = STRVEC_INIT; /* Cannot stat if what we used to build on no longer exists */ if (read_ref(base, &oid)) @@ -1911,12 +1911,12 @@ static int stat_branch_pair(const char *branch_name, const char *base, BUG("stat_branch_pair: invalid abf '%d'", abf); /* Run "rev-list --left-right ours...theirs" internally... */ - argv_array_push(&argv, ""); /* ignored */ - argv_array_push(&argv, "--left-right"); - argv_array_pushf(&argv, "%s...%s", + strvec_push(&argv, ""); /* ignored */ + strvec_push(&argv, "--left-right"); + strvec_pushf(&argv, "%s...%s", oid_to_hex(&ours->object.oid), oid_to_hex(&theirs->object.oid)); - argv_array_push(&argv, "--"); + strvec_push(&argv, "--"); repo_init_revisions(the_repository, &revs, NULL); setup_revisions(argv.argc, argv.argv, &revs, NULL); @@ -1938,7 +1938,7 @@ static int stat_branch_pair(const char *branch_name, const char *base, clear_commit_marks(ours, ALL_REV_FLAGS); clear_commit_marks(theirs, ALL_REV_FLAGS); - argv_array_clear(&argv); + strvec_clear(&argv); return 1; } diff --git a/revision.c b/revision.c index 07e16ed44b..e144132ae9 100644 --- a/revision.c +++ b/revision.c @@ -2073,14 +2073,14 @@ int handle_revision_arg(const char *arg_, struct rev_info *revs, int flags, unsi } static void read_pathspec_from_stdin(struct strbuf *sb, - struct argv_array *prune) + struct strvec *prune) { while (strbuf_getline(sb, stdin) != EOF) - argv_array_push(prune, sb->buf); + strvec_push(prune, sb->buf); } static void read_revisions_from_stdin(struct rev_info *revs, - struct argv_array *prune) + struct strvec *prune) { struct strbuf sb; int seen_dashdash = 0; @@ -2675,7 +2675,7 @@ static void NORETURN diagnose_missing_default(const char *def) int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct setup_revision_opt *opt) { int i, flags, left, seen_dashdash, got_rev_arg = 0, revarg_opt; - struct argv_array prune_data = ARGV_ARRAY_INIT; + struct strvec prune_data = STRVEC_INIT; const char *submodule = NULL; int seen_end_of_options = 0; @@ -2694,7 +2694,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s argv[i] = NULL; argc = i; if (argv[i + 1]) - argv_array_pushv(&prune_data, argv + i + 1); + strvec_pushv(&prune_data, argv + i + 1); seen_dashdash = 1; break; } @@ -2760,7 +2760,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s for (j = i; j < argc; j++) verify_filename(revs->prefix, argv[j], j == i); - argv_array_pushv(&prune_data, argv + i); + strvec_pushv(&prune_data, argv + i); break; } else @@ -2785,7 +2785,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s parse_pathspec(&revs->prune_data, 0, 0, revs->prefix, prune_data.argv); } - argv_array_clear(&prune_data); + strvec_clear(&prune_data); if (revs->def == NULL) revs->def = opt ? opt->def : NULL; diff --git a/run-command.c b/run-command.c index 8f57661d96..b9630a1b5f 100644 --- a/run-command.c +++ b/run-command.c @@ -11,14 +11,14 @@ void child_process_init(struct child_process *child) { memset(child, 0, sizeof(*child)); - argv_array_init(&child->args); - argv_array_init(&child->env_array); + strvec_init(&child->args); + strvec_init(&child->env_array); } void child_process_clear(struct child_process *child) { - argv_array_clear(&child->args); - argv_array_clear(&child->env_array); + strvec_clear(&child->args); + strvec_clear(&child->env_array); } struct child_to_clean { @@ -263,30 +263,30 @@ int sane_execvp(const char *file, char * const argv[]) return -1; } -static const char **prepare_shell_cmd(struct argv_array *out, const char **argv) +static const char **prepare_shell_cmd(struct strvec *out, const char **argv) { if (!argv[0]) BUG("shell command is empty"); if (strcspn(argv[0], "|&;<>()$`\\\"' \t\n*?[#~=%") != strlen(argv[0])) { #ifndef GIT_WINDOWS_NATIVE - argv_array_push(out, SHELL_PATH); + strvec_push(out, SHELL_PATH); #else - argv_array_push(out, "sh"); + strvec_push(out, "sh"); #endif - argv_array_push(out, "-c"); + strvec_push(out, "-c"); /* * If we have no extra arguments, we do not even need to * bother with the "$@" magic. */ if (!argv[1]) - argv_array_push(out, argv[0]); + strvec_push(out, argv[0]); else - argv_array_pushf(out, "%s \"$@\"", argv[0]); + strvec_pushf(out, "%s \"$@\"", argv[0]); } - argv_array_pushv(out, argv); + strvec_pushv(out, argv); return out->argv; } @@ -401,7 +401,7 @@ static void child_err_spew(struct child_process *cmd, struct child_err *cerr) set_error_routine(old_errfn); } -static int prepare_cmd(struct argv_array *out, const struct child_process *cmd) +static int prepare_cmd(struct strvec *out, const struct child_process *cmd) { if (!cmd->argv[0]) BUG("command is empty"); @@ -410,14 +410,14 @@ static int prepare_cmd(struct argv_array *out, const struct child_process *cmd) * Add SHELL_PATH so in the event exec fails with ENOEXEC we can * attempt to interpret the command with 'sh'. */ - argv_array_push(out, SHELL_PATH); + strvec_push(out, SHELL_PATH); if (cmd->git_cmd) { prepare_git_cmd(out, cmd->argv); } else if (cmd->use_shell) { prepare_shell_cmd(out, cmd->argv); } else { - argv_array_pushv(out, cmd->argv); + strvec_pushv(out, cmd->argv); } /* @@ -432,7 +432,7 @@ static int prepare_cmd(struct argv_array *out, const struct child_process *cmd) free((char *)out->argv[1]); out->argv[1] = program; } else { - argv_array_clear(out); + strvec_clear(out); errno = ENOENT; return -1; } @@ -742,7 +742,7 @@ fail_pipe: int notify_pipe[2]; int null_fd = -1; char **childenv; - struct argv_array argv = ARGV_ARRAY_INIT; + struct strvec argv = STRVEC_INIT; struct child_err cerr; struct atfork_state as; @@ -888,7 +888,7 @@ fail_pipe: if (null_fd >= 0) close(null_fd); - argv_array_clear(&argv); + strvec_clear(&argv); free(childenv); } end_of_spawn: @@ -897,7 +897,7 @@ end_of_spawn: { int fhin = 0, fhout = 1, fherr = 2; const char **sargv = cmd->argv; - struct argv_array nargv = ARGV_ARRAY_INIT; + struct strvec nargv = STRVEC_INIT; if (cmd->no_stdin) fhin = open("/dev/null", O_RDWR); @@ -935,7 +935,7 @@ end_of_spawn: if (cmd->clean_on_exit && cmd->pid >= 0) mark_child_for_cleanup(cmd->pid, cmd); - argv_array_clear(&nargv); + strvec_clear(&nargv); cmd->argv = sargv; if (fhin != 0) close(fhin); @@ -1352,9 +1352,9 @@ int run_hook_ve(const char *const *env, const char *name, va_list args) if (!p) return 0; - argv_array_push(&hook.args, p); + strvec_push(&hook.args, p); while ((p = va_arg(args, const char *))) - argv_array_push(&hook.args, p); + strvec_push(&hook.args, p); hook.env = env; hook.no_stdin = 1; hook.stdout_to_stderr = 1; @@ -1868,13 +1868,13 @@ int run_processes_parallel_tr2(int n, get_next_task_fn get_next_task, int run_auto_gc(int quiet) { - struct argv_array argv_gc_auto = ARGV_ARRAY_INIT; + struct strvec argv_gc_auto = STRVEC_INIT; int status; - argv_array_pushl(&argv_gc_auto, "gc", "--auto", NULL); + strvec_pushl(&argv_gc_auto, "gc", "--auto", NULL); if (quiet) - argv_array_push(&argv_gc_auto, "--quiet"); + strvec_push(&argv_gc_auto, "--quiet"); status = run_command_v_opt(argv_gc_auto.argv, RUN_GIT_CMD); - argv_array_clear(&argv_gc_auto); + strvec_clear(&argv_gc_auto); return status; } diff --git a/run-command.h b/run-command.h index f5e05d38d2..8b9bfaef16 100644 --- a/run-command.h +++ b/run-command.h @@ -52,15 +52,15 @@ struct child_process { * Note that the ownership of the memory pointed to by .argv stays with the * caller, but it should survive until `finish_command` completes. If the * .argv member is NULL, `start_command` will point it at the .args - * `argv_array` (so you may use one or the other, but you must use exactly + * `strvec` (so you may use one or the other, but you must use exactly * one). The memory in .args will be cleaned up automatically during * `finish_command` (or during `start_command` when it is unsuccessful). * */ const char **argv; - struct argv_array args; - struct argv_array env_array; + struct strvec args; + struct strvec env_array; pid_t pid; int trace2_child_id; @@ -107,7 +107,7 @@ struct child_process { * variable that will be removed from the child process's environment. * * If the .env member is NULL, `start_command` will point it at the - * .env_array `argv_array` (so you may use one or the other, but not both). + * .env_array `strvec` (so you may use one or the other, but not both). * The memory in .env_array will be cleaned up automatically during * `finish_command` (or during `start_command` when it is unsuccessful). */ @@ -134,7 +134,7 @@ struct child_process { void *clean_on_exit_handler_cbdata; }; -#define CHILD_PROCESS_INIT { NULL, ARGV_ARRAY_INIT, ARGV_ARRAY_INIT } +#define CHILD_PROCESS_INIT { NULL, STRVEC_INIT, STRVEC_INIT } /** * The functions: child_process_init, start_command, finish_command, diff --git a/send-pack.c b/send-pack.c index d671ab5d05..632f1580ca 100644 --- a/send-pack.c +++ b/send-pack.c @@ -68,20 +68,20 @@ static int pack_objects(int fd, struct ref *refs, struct oid_array *extra, struc int i; int rc; - 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"); + strvec_push(&po.args, "pack-objects"); + strvec_push(&po.args, "--all-progress-implied"); + strvec_push(&po.args, "--revs"); + strvec_push(&po.args, "--stdout"); if (args->use_thin_pack) - argv_array_push(&po.args, "--thin"); + strvec_push(&po.args, "--thin"); if (args->use_ofs_delta) - argv_array_push(&po.args, "--delta-base-offset"); + strvec_push(&po.args, "--delta-base-offset"); if (args->quiet || !args->progress) - argv_array_push(&po.args, "-q"); + strvec_push(&po.args, "-q"); if (args->progress) - argv_array_push(&po.args, "--progress"); + strvec_push(&po.args, "--progress"); if (is_repository_shallow(the_repository)) - argv_array_push(&po.args, "--shallow"); + strvec_push(&po.args, "--shallow"); po.in = -1; po.out = args->stateless_rpc ? -1 : fd; po.git_cmd = 1; diff --git a/sequencer.c b/sequencer.c index 9e7f868b00..80c770968a 100644 --- a/sequencer.c +++ b/sequencer.c @@ -830,10 +830,10 @@ finish: /* * Read a GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL AND GIT_AUTHOR_DATE from a - * file with shell quoting into struct argv_array. Returns -1 on + * file with shell quoting into struct strvec. Returns -1 on * error, 0 otherwise. */ -static int read_env_script(struct argv_array *env) +static int read_env_script(struct strvec *env) { char *name, *email, *date; @@ -841,9 +841,9 @@ static int read_env_script(struct argv_array *env) &name, &email, &date, 0)) return -1; - argv_array_pushf(env, "GIT_AUTHOR_NAME=%s", name); - argv_array_pushf(env, "GIT_AUTHOR_EMAIL=%s", email); - argv_array_pushf(env, "GIT_AUTHOR_DATE=%s", date); + strvec_pushf(env, "GIT_AUTHOR_NAME=%s", name); + strvec_pushf(env, "GIT_AUTHOR_EMAIL=%s", email); + strvec_pushf(env, "GIT_AUTHOR_DATE=%s", date); free(name); free(email); free(date); @@ -929,34 +929,34 @@ static int run_git_commit(struct repository *r, gpg_opt, gpg_opt); } - argv_array_push(&cmd.args, "commit"); + strvec_push(&cmd.args, "commit"); if (!(flags & VERIFY_MSG)) - argv_array_push(&cmd.args, "-n"); + strvec_push(&cmd.args, "-n"); if ((flags & AMEND_MSG)) - argv_array_push(&cmd.args, "--amend"); + strvec_push(&cmd.args, "--amend"); if (opts->gpg_sign) - argv_array_pushf(&cmd.args, "-S%s", opts->gpg_sign); + strvec_pushf(&cmd.args, "-S%s", opts->gpg_sign); else - argv_array_push(&cmd.args, "--no-gpg-sign"); + strvec_push(&cmd.args, "--no-gpg-sign"); if (defmsg) - argv_array_pushl(&cmd.args, "-F", defmsg, NULL); + strvec_pushl(&cmd.args, "-F", defmsg, NULL); else if (!(flags & EDIT_MSG)) - argv_array_pushl(&cmd.args, "-C", "HEAD", NULL); + strvec_pushl(&cmd.args, "-C", "HEAD", NULL); if ((flags & CLEANUP_MSG)) - argv_array_push(&cmd.args, "--cleanup=strip"); + strvec_push(&cmd.args, "--cleanup=strip"); if ((flags & EDIT_MSG)) - argv_array_push(&cmd.args, "-e"); + strvec_push(&cmd.args, "-e"); else if (!(flags & CLEANUP_MSG) && !opts->signoff && !opts->record_origin && !opts->explicit_cleanup) - argv_array_push(&cmd.args, "--cleanup=verbatim"); + strvec_push(&cmd.args, "--cleanup=verbatim"); if ((flags & ALLOW_EMPTY)) - argv_array_push(&cmd.args, "--allow-empty"); + strvec_push(&cmd.args, "--allow-empty"); if (!(flags & EDIT_MSG)) - argv_array_push(&cmd.args, "--allow-empty-message"); + strvec_push(&cmd.args, "--allow-empty-message"); if (is_rebase_i(opts) && !(flags & EDIT_MSG)) return run_command_silent_on_success(&cmd); @@ -2754,15 +2754,15 @@ static int rollback_is_safe(void) static int reset_merge(const struct object_id *oid) { int ret; - struct argv_array argv = ARGV_ARRAY_INIT; + struct strvec argv = STRVEC_INIT; - argv_array_pushl(&argv, "reset", "--merge", NULL); + strvec_pushl(&argv, "reset", "--merge", NULL); if (!is_null_oid(oid)) - argv_array_push(&argv, oid_to_hex(oid)); + strvec_push(&argv, oid_to_hex(oid)); ret = run_command_v_opt(argv.argv, RUN_GIT_CMD); - argv_array_clear(&argv); + strvec_clear(&argv); return ret; } @@ -3125,14 +3125,14 @@ static int error_failed_squash(struct repository *r, static int do_exec(struct repository *r, const char *command_line) { - struct argv_array child_env = ARGV_ARRAY_INIT; + struct strvec child_env = STRVEC_INIT; const char *child_argv[] = { NULL, NULL }; int dirty, status; fprintf(stderr, _("Executing: %s\n"), command_line); child_argv[0] = command_line; - argv_array_pushf(&child_env, "GIT_DIR=%s", absolute_path(get_git_dir())); - argv_array_pushf(&child_env, "GIT_WORK_TREE=%s", + strvec_pushf(&child_env, "GIT_DIR=%s", absolute_path(get_git_dir())); + strvec_pushf(&child_env, "GIT_WORK_TREE=%s", absolute_path(get_git_work_tree())); status = run_command_v_opt_cd_env(child_argv, RUN_USING_SHELL, NULL, child_env.argv); @@ -3165,7 +3165,7 @@ static int do_exec(struct repository *r, const char *command_line) status = 1; } - argv_array_clear(&child_env); + strvec_clear(&child_env); return status; } @@ -3544,28 +3544,28 @@ static int do_merge(struct repository *r, } cmd.git_cmd = 1; - argv_array_push(&cmd.args, "merge"); - argv_array_push(&cmd.args, "-s"); + strvec_push(&cmd.args, "merge"); + strvec_push(&cmd.args, "-s"); if (!strategy) - argv_array_push(&cmd.args, "octopus"); + strvec_push(&cmd.args, "octopus"); else { - argv_array_push(&cmd.args, strategy); + strvec_push(&cmd.args, strategy); for (k = 0; k < opts->xopts_nr; k++) - argv_array_pushf(&cmd.args, + strvec_pushf(&cmd.args, "-X%s", opts->xopts[k]); } - argv_array_push(&cmd.args, "--no-edit"); - argv_array_push(&cmd.args, "--no-ff"); - argv_array_push(&cmd.args, "--no-log"); - argv_array_push(&cmd.args, "--no-stat"); - argv_array_push(&cmd.args, "-F"); - argv_array_push(&cmd.args, git_path_merge_msg(r)); + strvec_push(&cmd.args, "--no-edit"); + strvec_push(&cmd.args, "--no-ff"); + strvec_push(&cmd.args, "--no-log"); + strvec_push(&cmd.args, "--no-stat"); + strvec_push(&cmd.args, "-F"); + strvec_push(&cmd.args, git_path_merge_msg(r)); if (opts->gpg_sign) - argv_array_push(&cmd.args, opts->gpg_sign); + strvec_push(&cmd.args, opts->gpg_sign); /* Add the tips to be merged */ for (j = to_merge; j; j = j->next) - argv_array_push(&cmd.args, + strvec_push(&cmd.args, oid_to_hex(&j->item->object.oid)); strbuf_release(&ref_name); @@ -3694,7 +3694,7 @@ void create_autostash(struct repository *r, const char *path, struct child_process stash = CHILD_PROCESS_INIT; struct object_id oid; - argv_array_pushl(&stash.args, + strvec_pushl(&stash.args, "stash", "create", "autostash", NULL); stash.git_cmd = 1; stash.no_stdin = 1; @@ -3734,9 +3734,9 @@ static int apply_save_autostash_oid(const char *stash_oid, int attempt_apply) child.git_cmd = 1; child.no_stdout = 1; child.no_stderr = 1; - argv_array_push(&child.args, "stash"); - argv_array_push(&child.args, "apply"); - argv_array_push(&child.args, stash_oid); + strvec_push(&child.args, "stash"); + strvec_push(&child.args, "apply"); + strvec_push(&child.args, stash_oid); ret = run_command(&child); } @@ -3746,12 +3746,12 @@ static int apply_save_autostash_oid(const char *stash_oid, int attempt_apply) struct child_process store = CHILD_PROCESS_INIT; store.git_cmd = 1; - argv_array_push(&store.args, "stash"); - argv_array_push(&store.args, "store"); - argv_array_push(&store.args, "-m"); - argv_array_push(&store.args, "autostash"); - argv_array_push(&store.args, "-q"); - argv_array_push(&store.args, stash_oid); + strvec_push(&store.args, "stash"); + strvec_push(&store.args, "store"); + strvec_push(&store.args, "-m"); + strvec_push(&store.args, "autostash"); + strvec_push(&store.args, "-q"); + strvec_push(&store.args, stash_oid); if (run_command(&store)) ret = error(_("cannot store %s"), stash_oid); else @@ -3831,9 +3831,9 @@ static int run_git_checkout(struct repository *r, struct replay_opts *opts, cmd.git_cmd = 1; - argv_array_push(&cmd.args, "checkout"); - argv_array_push(&cmd.args, commit); - argv_array_pushf(&cmd.env_array, GIT_REFLOG_ACTION "=%s", action); + strvec_push(&cmd.args, "checkout"); + strvec_push(&cmd.args, commit); + strvec_pushf(&cmd.env_array, GIT_REFLOG_ACTION "=%s", action); if (opts->verbose) ret = run_command(&cmd); @@ -4157,9 +4157,9 @@ cleanup_head_ref: child.in = open(rebase_path_rewritten_list(), O_RDONLY); child.git_cmd = 1; - argv_array_push(&child.args, "notes"); - argv_array_push(&child.args, "copy"); - argv_array_push(&child.args, "--for-rewrite=rebase"); + strvec_push(&child.args, "notes"); + strvec_push(&child.args, "copy"); + strvec_push(&child.args, "--for-rewrite=rebase"); /* we don't care if this copying failed */ run_command(&child); @@ -4170,8 +4170,8 @@ cleanup_head_ref: O_RDONLY); hook.stdout_to_stderr = 1; hook.trace2_hook_name = "post-rewrite"; - argv_array_push(&hook.args, post_rewrite_hook); - argv_array_push(&hook.args, "rebase"); + strvec_push(&hook.args, post_rewrite_hook); + strvec_push(&hook.args, "rebase"); /* we don't care if this hook failed */ run_command(&hook); } diff --git a/serve.c b/serve.c index 8d9a345b3d..523a9be32d 100644 --- a/serve.c +++ b/serve.c @@ -56,7 +56,7 @@ struct protocol_capability { * This field should be NULL for capabilities which are not commands. */ int (*command)(struct repository *r, - struct argv_array *keys, + struct strvec *keys, struct packet_reader *request); }; @@ -142,7 +142,7 @@ static int is_command(const char *key, struct protocol_capability **command) return 0; } -int has_capability(const struct argv_array *keys, const char *capability, +int has_capability(const struct strvec *keys, const char *capability, const char **value) { int i; @@ -162,7 +162,7 @@ int has_capability(const struct argv_array *keys, const char *capability, return 0; } -static void check_algorithm(struct repository *r, struct argv_array *keys) +static void check_algorithm(struct repository *r, struct strvec *keys) { int client = GIT_HASH_SHA1, server = hash_algo_by_ptr(r->hash_algo); const char *algo_name; @@ -187,7 +187,7 @@ static int process_request(void) { enum request_state state = PROCESS_REQUEST_KEYS; struct packet_reader reader; - struct argv_array keys = ARGV_ARRAY_INIT; + struct strvec keys = STRVEC_INIT; struct protocol_capability *command = NULL; packet_reader_init(&reader, 0, NULL, 0, @@ -211,7 +211,7 @@ static int process_request(void) /* collect request; a sequence of keys and values */ if (is_command(reader.line, &command) || is_valid_capability(reader.line)) - argv_array_push(&keys, reader.line); + strvec_push(&keys, reader.line); else die("unknown capability '%s'", reader.line); @@ -254,7 +254,7 @@ static int process_request(void) command->command(the_repository, &keys, &reader); - argv_array_clear(&keys); + strvec_clear(&keys); return 0; } diff --git a/sha1-file.c b/sha1-file.c index ccd34dd9e8..a7f7a14898 100644 --- a/sha1-file.c +++ b/sha1-file.c @@ -763,18 +763,18 @@ static void fill_alternate_refs_command(struct child_process *cmd, if (!git_config_get_value("core.alternateRefsCommand", &value)) { cmd->use_shell = 1; - argv_array_push(&cmd->args, value); - argv_array_push(&cmd->args, repo_path); + strvec_push(&cmd->args, value); + strvec_push(&cmd->args, repo_path); } else { cmd->git_cmd = 1; - argv_array_pushf(&cmd->args, "--git-dir=%s", repo_path); - argv_array_push(&cmd->args, "for-each-ref"); - argv_array_push(&cmd->args, "--format=%(objectname)"); + strvec_pushf(&cmd->args, "--git-dir=%s", repo_path); + strvec_push(&cmd->args, "for-each-ref"); + strvec_push(&cmd->args, "--format=%(objectname)"); if (!git_config_get_value("core.alternateRefsPrefixes", &value)) { - argv_array_push(&cmd->args, "--"); - argv_array_split(&cmd->args, value); + strvec_push(&cmd->args, "--"); + strvec_split(&cmd->args, value); } } diff --git a/sub-process.c b/sub-process.c index 1b1af9dcbd..dfa790d3ff 100644 --- a/sub-process.c +++ b/sub-process.c @@ -84,7 +84,7 @@ int subprocess_start(struct hashmap *hashmap, struct subprocess_entry *entry, co process = &entry->process; child_process_init(process); - argv_array_push(&process->args, cmd); + strvec_push(&process->args, cmd); process->use_shell = 1; process->in = -1; process->out = -1; diff --git a/submodule.c b/submodule.c index 874db5c4b2..5c9447422d 100644 --- a/submodule.c +++ b/submodule.c @@ -262,17 +262,17 @@ int is_submodule_active(struct repository *repo, const char *path) sl = repo_config_get_value_multi(repo, "submodule.active"); if (sl) { struct pathspec ps; - struct argv_array args = ARGV_ARRAY_INIT; + struct strvec args = STRVEC_INIT; const struct string_list_item *item; for_each_string_list_item(item, sl) { - argv_array_push(&args, item->string); + strvec_push(&args, item->string); } parse_pathspec(&ps, 0, 0, NULL, args.argv); ret = match_pathspec(repo->index, &ps, path, strlen(path), 0, NULL, 1); - argv_array_clear(&args); + strvec_clear(&args); clear_pathspec(&ps); return ret; } @@ -481,27 +481,27 @@ static void print_submodule_summary(struct repository *r, struct rev_info *rev, strbuf_release(&sb); } -static void prepare_submodule_repo_env_no_git_dir(struct argv_array *out) +static void prepare_submodule_repo_env_no_git_dir(struct strvec *out) { const char * const *var; for (var = local_repo_env; *var; var++) { if (strcmp(*var, CONFIG_DATA_ENVIRONMENT)) - argv_array_push(out, *var); + strvec_push(out, *var); } } -void prepare_submodule_repo_env(struct argv_array *out) +void prepare_submodule_repo_env(struct strvec *out) { prepare_submodule_repo_env_no_git_dir(out); - argv_array_pushf(out, "%s=%s", GIT_DIR_ENVIRONMENT, + strvec_pushf(out, "%s=%s", GIT_DIR_ENVIRONMENT, DEFAULT_GIT_DIR_ENVIRONMENT); } -static void prepare_submodule_repo_env_in_gitdir(struct argv_array *out) +static void prepare_submodule_repo_env_in_gitdir(struct strvec *out) { prepare_submodule_repo_env_no_git_dir(out); - argv_array_pushf(out, "%s=.", GIT_DIR_ENVIRONMENT); + strvec_pushf(out, "%s=.", GIT_DIR_ENVIRONMENT); } /* @@ -681,22 +681,22 @@ void show_submodule_inline_diff(struct diff_options *o, const char *path, cp.no_stdin = 1; /* TODO: other options may need to be passed here. */ - argv_array_pushl(&cp.args, "diff", "--submodule=diff", NULL); - argv_array_pushf(&cp.args, "--color=%s", want_color(o->use_color) ? + strvec_pushl(&cp.args, "diff", "--submodule=diff", NULL); + strvec_pushf(&cp.args, "--color=%s", want_color(o->use_color) ? "always" : "never"); if (o->flags.reverse_diff) { - argv_array_pushf(&cp.args, "--src-prefix=%s%s/", + strvec_pushf(&cp.args, "--src-prefix=%s%s/", o->b_prefix, path); - argv_array_pushf(&cp.args, "--dst-prefix=%s%s/", + strvec_pushf(&cp.args, "--dst-prefix=%s%s/", o->a_prefix, path); } else { - argv_array_pushf(&cp.args, "--src-prefix=%s%s/", + strvec_pushf(&cp.args, "--src-prefix=%s%s/", o->a_prefix, path); - argv_array_pushf(&cp.args, "--dst-prefix=%s%s/", + strvec_pushf(&cp.args, "--dst-prefix=%s%s/", o->b_prefix, path); } - argv_array_push(&cp.args, oid_to_hex(old_oid)); + strvec_push(&cp.args, oid_to_hex(old_oid)); /* * If the submodule has modified content, we will diff against the * work tree, under the assumption that the user has asked for the @@ -704,7 +704,7 @@ void show_submodule_inline_diff(struct diff_options *o, const char *path, * haven't yet been committed to the submodule yet. */ if (!(dirty_submodule & DIRTY_SUBMODULE_MODIFIED)) - argv_array_push(&cp.args, oid_to_hex(new_oid)); + strvec_push(&cp.args, oid_to_hex(new_oid)); prepare_submodule_repo_env(&cp.env_array); if (start_command(&cp)) @@ -836,7 +836,7 @@ static void collect_changed_submodules_cb(struct diff_queue_struct *q, */ static void collect_changed_submodules(struct repository *r, struct string_list *changed, - struct argv_array *argv) + struct strvec *argv) { struct rev_info rev; const struct commit *commit; @@ -879,8 +879,8 @@ static int has_remote(const char *refname, const struct object_id *oid, static int append_oid_to_argv(const struct object_id *oid, void *data) { - struct argv_array *argv = data; - argv_array_push(argv, oid_to_hex(oid)); + struct strvec *argv = data; + strvec_push(argv, oid_to_hex(oid)); return 0; } @@ -941,9 +941,9 @@ static int submodule_has_commits(struct repository *r, struct child_process cp = CHILD_PROCESS_INIT; struct strbuf out = STRBUF_INIT; - argv_array_pushl(&cp.args, "rev-list", "-n", "1", NULL); + strvec_pushl(&cp.args, "rev-list", "-n", "1", NULL); oid_array_for_each_unique(commits, append_oid_to_argv, &cp.args); - argv_array_pushl(&cp.args, "--not", "--all", NULL); + strvec_pushl(&cp.args, "--not", "--all", NULL); prepare_submodule_repo_env(&cp.env_array); cp.git_cmd = 1; @@ -982,9 +982,9 @@ static int submodule_needs_pushing(struct repository *r, struct strbuf buf = STRBUF_INIT; int needs_pushing = 0; - argv_array_push(&cp.args, "rev-list"); + strvec_push(&cp.args, "rev-list"); oid_array_for_each_unique(commits, append_oid_to_argv, &cp.args); - argv_array_pushl(&cp.args, "--not", "--remotes", "-n", "1" , NULL); + strvec_pushl(&cp.args, "--not", "--remotes", "-n", "1" , NULL); prepare_submodule_repo_env(&cp.env_array); cp.git_cmd = 1; @@ -1012,13 +1012,13 @@ int find_unpushed_submodules(struct repository *r, { struct string_list submodules = STRING_LIST_INIT_DUP; struct string_list_item *name; - struct argv_array argv = ARGV_ARRAY_INIT; + struct strvec argv = STRVEC_INIT; /* argv.argv[0] will be ignored by setup_revisions */ - argv_array_push(&argv, "find_unpushed_submodules"); + strvec_push(&argv, "find_unpushed_submodules"); oid_array_for_each_unique(commits, append_oid_to_argv, &argv); - argv_array_push(&argv, "--not"); - argv_array_pushf(&argv, "--remotes=%s", remotes_name); + strvec_push(&argv, "--not"); + strvec_pushf(&argv, "--remotes=%s", remotes_name); collect_changed_submodules(r, &submodules, &argv); @@ -1041,7 +1041,7 @@ int find_unpushed_submodules(struct repository *r, } free_submodules_oids(&submodules); - argv_array_clear(&argv); + strvec_clear(&argv); return needs_pushing->nr; } @@ -1054,22 +1054,22 @@ static int push_submodule(const char *path, { if (for_each_remote_ref_submodule(path, has_remote, NULL) > 0) { struct child_process cp = CHILD_PROCESS_INIT; - argv_array_push(&cp.args, "push"); + strvec_push(&cp.args, "push"); if (dry_run) - argv_array_push(&cp.args, "--dry-run"); + strvec_push(&cp.args, "--dry-run"); if (push_options && push_options->nr) { const struct string_list_item *item; for_each_string_list_item(item, push_options) - argv_array_pushf(&cp.args, "--push-option=%s", + strvec_pushf(&cp.args, "--push-option=%s", item->string); } if (remote->origin != REMOTE_UNCONFIGURED) { int i; - argv_array_push(&cp.args, remote->name); + strvec_push(&cp.args, remote->name); for (i = 0; i < rs->raw_nr; i++) - argv_array_push(&cp.args, rs->raw[i]); + strvec_push(&cp.args, rs->raw[i]); } prepare_submodule_repo_env(&cp.env_array); @@ -1095,13 +1095,13 @@ static void submodule_push_check(const char *path, const char *head, struct child_process cp = CHILD_PROCESS_INIT; int i; - argv_array_push(&cp.args, "submodule--helper"); - argv_array_push(&cp.args, "push-check"); - argv_array_push(&cp.args, head); - argv_array_push(&cp.args, remote->name); + strvec_push(&cp.args, "submodule--helper"); + strvec_push(&cp.args, "push-check"); + strvec_push(&cp.args, head); + strvec_push(&cp.args, remote->name); for (i = 0; i < rs->raw_nr; i++) - argv_array_push(&cp.args, rs->raw[i]); + strvec_push(&cp.args, rs->raw[i]); prepare_submodule_repo_env(&cp.env_array); cp.git_cmd = 1; @@ -1189,17 +1189,17 @@ void check_for_new_submodule_commits(struct object_id *oid) static void calculate_changed_submodule_paths(struct repository *r, struct string_list *changed_submodule_names) { - struct argv_array argv = ARGV_ARRAY_INIT; + struct strvec argv = STRVEC_INIT; struct string_list_item *name; /* No need to check if there are no submodules configured */ if (!submodule_from_path(r, NULL, NULL)) return; - argv_array_push(&argv, "--"); /* argv[0] program name */ + strvec_push(&argv, "--"); /* argv[0] program name */ oid_array_for_each_unique(&ref_tips_after_fetch, append_oid_to_argv, &argv); - argv_array_push(&argv, "--not"); + strvec_push(&argv, "--not"); oid_array_for_each_unique(&ref_tips_before_fetch, append_oid_to_argv, &argv); @@ -1231,7 +1231,7 @@ static void calculate_changed_submodule_paths(struct repository *r, string_list_remove_empty_items(changed_submodule_names, 1); - argv_array_clear(&argv); + strvec_clear(&argv); oid_array_clear(&ref_tips_before_fetch); oid_array_clear(&ref_tips_after_fetch); initialized_fetch_ref_tips = 0; @@ -1242,24 +1242,24 @@ int submodule_touches_in_range(struct repository *r, struct object_id *incl_oid) { struct string_list subs = STRING_LIST_INIT_DUP; - struct argv_array args = ARGV_ARRAY_INIT; + struct strvec args = STRVEC_INIT; int ret; /* No need to check if there are no submodules configured */ if (!submodule_from_path(r, NULL, NULL)) return 0; - argv_array_push(&args, "--"); /* args[0] program name */ - argv_array_push(&args, oid_to_hex(incl_oid)); + strvec_push(&args, "--"); /* args[0] program name */ + strvec_push(&args, oid_to_hex(incl_oid)); if (!is_null_oid(excl_oid)) { - argv_array_push(&args, "--not"); - argv_array_push(&args, oid_to_hex(excl_oid)); + strvec_push(&args, "--not"); + strvec_push(&args, oid_to_hex(excl_oid)); } collect_changed_submodules(r, &subs, &args); ret = subs.nr; - argv_array_clear(&args); + strvec_clear(&args); free_submodules_oids(&subs); return ret; @@ -1267,7 +1267,7 @@ int submodule_touches_in_range(struct repository *r, struct submodule_parallel_fetch { int count; - struct argv_array args; + struct strvec args; struct repository *r; const char *prefix; int command_line_option; @@ -1283,7 +1283,7 @@ struct submodule_parallel_fetch { struct strbuf submodules_with_errors; }; -#define SPF_INIT {0, ARGV_ARRAY_INIT, NULL, NULL, 0, 0, 0, 0, \ +#define SPF_INIT {0, STRVEC_INIT, NULL, NULL, 0, 0, 0, 0, \ STRING_LIST_INIT_DUP, \ NULL, 0, 0, STRBUF_INIT} @@ -1452,15 +1452,15 @@ static int get_next_submodule(struct child_process *cp, if (!spf->quiet) strbuf_addf(err, _("Fetching submodule %s%s\n"), spf->prefix, ce->name); - argv_array_init(&cp->args); - argv_array_pushv(&cp->args, spf->args.argv); - argv_array_push(&cp->args, default_argv); - argv_array_push(&cp->args, "--submodule-prefix"); + strvec_init(&cp->args); + strvec_pushv(&cp->args, spf->args.argv); + strvec_push(&cp->args, default_argv); + strvec_push(&cp->args, "--submodule-prefix"); strbuf_addf(&submodule_prefix, "%s%s/", spf->prefix, task->sub->path); - argv_array_push(&cp->args, submodule_prefix.buf); + strvec_push(&cp->args, submodule_prefix.buf); spf->count++; *task_cb = task; @@ -1500,14 +1500,14 @@ static int get_next_submodule(struct child_process *cp, cp->git_cmd = 1; cp->dir = task->repo->gitdir; - argv_array_init(&cp->args); - argv_array_pushv(&cp->args, spf->args.argv); - argv_array_push(&cp->args, "on-demand"); - argv_array_push(&cp->args, "--submodule-prefix"); - argv_array_push(&cp->args, submodule_prefix.buf); + strvec_init(&cp->args); + strvec_pushv(&cp->args, spf->args.argv); + strvec_push(&cp->args, "on-demand"); + strvec_push(&cp->args, "--submodule-prefix"); + strvec_push(&cp->args, submodule_prefix.buf); /* NEEDSWORK: have get_default_remote from submodule--helper */ - argv_array_push(&cp->args, "origin"); + strvec_push(&cp->args, "origin"); oid_array_for_each_unique(task->commits, append_oid_to_argv, &cp->args); @@ -1598,7 +1598,7 @@ out: } int fetch_populated_submodules(struct repository *r, - const struct argv_array *options, + const struct strvec *options, const char *prefix, int command_line_option, int default_option, int quiet, int max_parallel_jobs) @@ -1618,10 +1618,10 @@ int fetch_populated_submodules(struct repository *r, if (repo_read_index(r) < 0) die(_("index file corrupt")); - argv_array_push(&spf.args, "fetch"); + strvec_push(&spf.args, "fetch"); for (i = 0; i < options->argc; i++) - argv_array_push(&spf.args, options->argv[i]); - argv_array_push(&spf.args, "--recurse-submodules-default"); + strvec_push(&spf.args, options->argv[i]); + strvec_push(&spf.args, "--recurse-submodules-default"); /* default value, "--submodule-prefix" and its value are added later */ calculate_changed_submodule_paths(r, &spf.changed_submodule_names); @@ -1638,7 +1638,7 @@ int fetch_populated_submodules(struct repository *r, spf.submodules_with_errors.buf); - argv_array_clear(&spf.args); + strvec_clear(&spf.args); out: free_submodules_oids(&spf.changed_submodule_names); return spf.result; @@ -1666,9 +1666,9 @@ unsigned is_submodule_modified(const char *path, int ignore_untracked) } strbuf_reset(&buf); - argv_array_pushl(&cp.args, "status", "--porcelain=2", NULL); + strvec_pushl(&cp.args, "status", "--porcelain=2", NULL); if (ignore_untracked) - argv_array_push(&cp.args, "-uno"); + strvec_push(&cp.args, "-uno"); prepare_submodule_repo_env(&cp.env_array); cp.git_cmd = 1; @@ -1779,16 +1779,16 @@ int bad_to_remove_submodule(const char *path, unsigned flags) if (!submodule_uses_gitfile(path)) return 1; - argv_array_pushl(&cp.args, "status", "--porcelain", + strvec_pushl(&cp.args, "status", "--porcelain", "--ignore-submodules=none", NULL); if (flags & SUBMODULE_REMOVAL_IGNORE_UNTRACKED) - argv_array_push(&cp.args, "-uno"); + strvec_push(&cp.args, "-uno"); else - argv_array_push(&cp.args, "-uall"); + strvec_push(&cp.args, "-uall"); if (!(flags & SUBMODULE_REMOVAL_IGNORE_IGNORED_UNTRACKED)) - argv_array_push(&cp.args, "--ignored"); + strvec_push(&cp.args, "--ignored"); prepare_submodule_repo_env(&cp.env_array); cp.git_cmd = 1; @@ -1846,7 +1846,7 @@ static int submodule_has_dirty_index(const struct submodule *sub) prepare_submodule_repo_env(&cp.env_array); cp.git_cmd = 1; - argv_array_pushl(&cp.args, "diff-index", "--quiet", + strvec_pushl(&cp.args, "diff-index", "--quiet", "--cached", "HEAD", NULL); cp.no_stdin = 1; cp.no_stdout = 1; @@ -1866,11 +1866,11 @@ static void submodule_reset_index(const char *path) cp.no_stdin = 1; cp.dir = path; - argv_array_pushf(&cp.args, "--super-prefix=%s%s/", + strvec_pushf(&cp.args, "--super-prefix=%s%s/", get_super_prefix_or_empty(), path); - argv_array_pushl(&cp.args, "read-tree", "-u", "--reset", NULL); + strvec_pushl(&cp.args, "read-tree", "-u", "--reset", NULL); - argv_array_push(&cp.args, empty_tree_oid_hex()); + strvec_push(&cp.args, empty_tree_oid_hex()); if (run_command(&cp)) die(_("could not reset submodule index")); @@ -1947,24 +1947,24 @@ int submodule_move_head(const char *path, cp.no_stdin = 1; cp.dir = path; - argv_array_pushf(&cp.args, "--super-prefix=%s%s/", + strvec_pushf(&cp.args, "--super-prefix=%s%s/", get_super_prefix_or_empty(), path); - argv_array_pushl(&cp.args, "read-tree", "--recurse-submodules", NULL); + strvec_pushl(&cp.args, "read-tree", "--recurse-submodules", NULL); if (flags & SUBMODULE_MOVE_HEAD_DRY_RUN) - argv_array_push(&cp.args, "-n"); + strvec_push(&cp.args, "-n"); else - argv_array_push(&cp.args, "-u"); + strvec_push(&cp.args, "-u"); if (flags & SUBMODULE_MOVE_HEAD_FORCE) - argv_array_push(&cp.args, "--reset"); + strvec_push(&cp.args, "--reset"); else - argv_array_push(&cp.args, "-m"); + strvec_push(&cp.args, "-m"); if (!(flags & SUBMODULE_MOVE_HEAD_FORCE)) - argv_array_push(&cp.args, old_head ? old_head : empty_tree_oid_hex()); + strvec_push(&cp.args, old_head ? old_head : empty_tree_oid_hex()); - argv_array_push(&cp.args, new_head ? new_head : empty_tree_oid_hex()); + strvec_push(&cp.args, new_head ? new_head : empty_tree_oid_hex()); if (run_command(&cp)) { ret = error(_("Submodule '%s' could not be updated."), path); @@ -1980,7 +1980,7 @@ int submodule_move_head(const char *path, cp.dir = path; prepare_submodule_repo_env(&cp.env_array); - argv_array_pushl(&cp.args, "update-ref", "HEAD", + strvec_pushl(&cp.args, "update-ref", "HEAD", "--no-deref", new_head, NULL); if (run_command(&cp)) { @@ -2157,7 +2157,7 @@ void absorb_git_dir_into_superproject(const char *path, cp.dir = path; cp.git_cmd = 1; cp.no_stdin = 1; - argv_array_pushl(&cp.args, "--super-prefix", sb.buf, + strvec_pushl(&cp.args, "--super-prefix", sb.buf, "submodule--helper", "absorb-git-dirs", NULL); prepare_submodule_repo_env(&cp.env_array); @@ -2194,9 +2194,9 @@ int get_superproject_working_tree(struct strbuf *buf) strbuf_release(&one_up); prepare_submodule_repo_env(&cp.env_array); - argv_array_pop(&cp.env_array); + strvec_pop(&cp.env_array); - argv_array_pushl(&cp.args, "--literal-pathspecs", "-C", "..", + strvec_pushl(&cp.args, "--literal-pathspecs", "-C", "..", "ls-files", "-z", "--stage", "--full-name", "--", subpath, NULL); strbuf_reset(&sb); diff --git a/t/helper/test-run-command.c b/t/helper/test-run-command.c index 8d3f6d5a5e..67dde56962 100644 --- a/t/helper/test-run-command.c +++ b/t/helper/test-run-command.c @@ -31,7 +31,7 @@ static int parallel_next(struct child_process *cp, if (number_callbacks >= 4) return 0; - argv_array_pushv(&cp->args, d->argv); + strvec_pushv(&cp->args, d->argv); strbuf_addstr(err, "preloaded output of a child\n"); number_callbacks++; return 1; @@ -72,19 +72,19 @@ static int next_test(struct child_process *cp, struct strbuf *err, void *cb, return 0; test = suite->tests.items[suite->next++].string; - argv_array_pushl(&cp->args, "sh", test, NULL); + strvec_pushl(&cp->args, "sh", test, NULL); if (suite->quiet) - argv_array_push(&cp->args, "--quiet"); + strvec_push(&cp->args, "--quiet"); if (suite->immediate) - argv_array_push(&cp->args, "-i"); + strvec_push(&cp->args, "-i"); if (suite->verbose) - argv_array_push(&cp->args, "-v"); + strvec_push(&cp->args, "-v"); if (suite->verbose_log) - argv_array_push(&cp->args, "-V"); + strvec_push(&cp->args, "-V"); if (suite->trace) - argv_array_push(&cp->args, "-x"); + strvec_push(&cp->args, "-x"); if (suite->write_junit_xml) - argv_array_push(&cp->args, "--write-junit-xml"); + strvec_push(&cp->args, "--write-junit-xml"); strbuf_addf(err, "Output of '%s':\n", test); *task_cb = (void *)test; @@ -220,7 +220,7 @@ static int quote_stress_test(int argc, const char **argv) char special[] = ".?*\\^_\"'`{}()[]<>@~&+:;$%"; // \t\r\n\a"; int i, j, k, trials = 100, skip = 0, msys2 = 0; struct strbuf out = STRBUF_INIT; - struct argv_array args = ARGV_ARRAY_INIT; + struct strvec args = STRVEC_INIT; struct option options[] = { OPT_INTEGER('n', "trials", &trials, "Number of trials"), OPT_INTEGER('s', "skip", &skip, "Skip trials"), @@ -241,12 +241,12 @@ static int quote_stress_test(int argc, const char **argv) size_t arg_count, arg_offset; int ret = 0; - argv_array_clear(&args); + strvec_clear(&args); if (msys2) - argv_array_pushl(&args, "sh", "-c", + strvec_pushl(&args, "sh", "-c", "printf %s\\\\0 \"$@\"", "skip", NULL); else - argv_array_pushl(&args, "test-tool", "run-command", + strvec_pushl(&args, "test-tool", "run-command", "quote-echo", NULL); arg_offset = args.argc; @@ -254,7 +254,7 @@ static int quote_stress_test(int argc, const char **argv) trials = 1; arg_count = argc; for (j = 0; j < arg_count; j++) - argv_array_push(&args, argv[j]); + strvec_push(&args, argv[j]); } else { arg_count = 1 + (my_random() % 5); for (j = 0; j < arg_count; j++) { @@ -268,7 +268,7 @@ static int quote_stress_test(int argc, const char **argv) ARRAY_SIZE(special)]; buf[arg_len] = '\0'; - argv_array_push(&args, buf); + strvec_push(&args, buf); } } @@ -301,7 +301,7 @@ static int quote_stress_test(int argc, const char **argv) (int)j, args.argv[j + arg_offset]); strbuf_release(&out); - argv_array_clear(&args); + strvec_clear(&args); return ret; } @@ -311,7 +311,7 @@ static int quote_stress_test(int argc, const char **argv) } strbuf_release(&out); - argv_array_clear(&args); + strvec_clear(&args); return 0; } @@ -338,7 +338,7 @@ static int inherit_handle(const char *argv0) xsnprintf(path, sizeof(path), "out-XXXXXX"); tmp = xmkstemp(path); - argv_array_pushl(&cp.args, + strvec_pushl(&cp.args, "test-tool", argv0, "inherited-handle-child", NULL); cp.in = -1; cp.no_stdout = cp.no_stderr = 1; @@ -391,7 +391,7 @@ int cmd__run_command(int argc, const char **argv) while (!strcmp(argv[1], "env")) { if (!argv[2]) die("env specifier without a value"); - argv_array_push(&proc.env_array, argv[2]); + strvec_push(&proc.env_array, argv[2]); argv += 2; argc -= 2; } diff --git a/tmp-objdir.c b/tmp-objdir.c index 06924a7875..e78e481d8e 100644 --- a/tmp-objdir.c +++ b/tmp-objdir.c @@ -10,7 +10,7 @@ struct tmp_objdir { struct strbuf path; - struct argv_array env; + struct strvec env; }; /* @@ -24,7 +24,7 @@ static struct tmp_objdir *the_tmp_objdir; static void tmp_objdir_free(struct tmp_objdir *t) { strbuf_release(&t->path); - argv_array_clear(&t->env); + strvec_clear(&t->env); free(t); } @@ -79,7 +79,7 @@ static void remove_tmp_objdir_on_signal(int signo) * separated by PATH_SEP (which is what separate values in * GIT_ALTERNATE_OBJECT_DIRECTORIES). */ -static void env_append(struct argv_array *env, const char *key, const char *val) +static void env_append(struct strvec *env, const char *key, const char *val) { struct strbuf quoted = STRBUF_INIT; const char *old; @@ -97,16 +97,16 @@ static void env_append(struct argv_array *env, const char *key, const char *val) old = getenv(key); if (!old) - argv_array_pushf(env, "%s=%s", key, val); + strvec_pushf(env, "%s=%s", key, val); else - argv_array_pushf(env, "%s=%s%c%s", key, old, PATH_SEP, val); + strvec_pushf(env, "%s=%s%c%s", key, old, PATH_SEP, val); strbuf_release("ed); } -static void env_replace(struct argv_array *env, const char *key, const char *val) +static void env_replace(struct strvec *env, const char *key, const char *val) { - argv_array_pushf(env, "%s=%s", key, val); + strvec_pushf(env, "%s=%s", key, val); } static int setup_tmp_objdir(const char *root) @@ -131,7 +131,7 @@ struct tmp_objdir *tmp_objdir_create(void) t = xmalloc(sizeof(*t)); strbuf_init(&t->path, 0); - argv_array_init(&t->env); + strvec_init(&t->env); strbuf_addf(&t->path, "%s/incoming-XXXXXX", get_object_directory()); diff --git a/transport-helper.c b/transport-helper.c index 441763fd7c..dcd4adf444 100644 --- a/transport-helper.c +++ b/transport-helper.c @@ -128,14 +128,14 @@ static struct child_process *get_helper(struct transport *transport) helper->in = -1; helper->out = -1; helper->err = 0; - argv_array_pushf(&helper->args, "git-remote-%s", data->name); - argv_array_push(&helper->args, transport->remote->name); - argv_array_push(&helper->args, remove_ext_force(transport->url)); + strvec_pushf(&helper->args, "git-remote-%s", data->name); + strvec_push(&helper->args, transport->remote->name); + strvec_push(&helper->args, remove_ext_force(transport->url)); helper->git_cmd = 0; helper->silent_exec_failure = 1; if (have_git_dir()) - argv_array_pushf(&helper->env_array, "%s=%s", + strvec_pushf(&helper->env_array, "%s=%s", GIT_DIR_ENVIRONMENT, get_git_dir()); helper->trace2_child_class = helper->args.argv[0]; /* "remote-" */ @@ -439,13 +439,13 @@ static int get_importer(struct transport *transport, struct child_process *fasti int cat_blob_fd, code; child_process_init(fastimport); fastimport->in = xdup(helper->out); - argv_array_push(&fastimport->args, "fast-import"); - argv_array_push(&fastimport->args, "--allow-unsafe-features"); - argv_array_push(&fastimport->args, debug ? "--stats" : "--quiet"); + strvec_push(&fastimport->args, "fast-import"); + strvec_push(&fastimport->args, "--allow-unsafe-features"); + strvec_push(&fastimport->args, debug ? "--stats" : "--quiet"); if (data->bidi_import) { cat_blob_fd = xdup(helper->in); - argv_array_pushf(&fastimport->args, "--cat-blob-fd=%d", cat_blob_fd); + strvec_pushf(&fastimport->args, "--cat-blob-fd=%d", cat_blob_fd); } fastimport->git_cmd = 1; @@ -466,17 +466,17 @@ static int get_exporter(struct transport *transport, /* we need to duplicate helper->in because we want to use it after * fastexport is done with it. */ fastexport->out = dup(helper->in); - argv_array_push(&fastexport->args, "fast-export"); - argv_array_push(&fastexport->args, "--use-done-feature"); - argv_array_push(&fastexport->args, data->signed_tags ? + strvec_push(&fastexport->args, "fast-export"); + strvec_push(&fastexport->args, "--use-done-feature"); + strvec_push(&fastexport->args, data->signed_tags ? "--signed-tags=verbatim" : "--signed-tags=warn-strip"); if (data->export_marks) - argv_array_pushf(&fastexport->args, "--export-marks=%s.tmp", data->export_marks); + strvec_pushf(&fastexport->args, "--export-marks=%s.tmp", data->export_marks); if (data->import_marks) - argv_array_pushf(&fastexport->args, "--import-marks=%s", data->import_marks); + strvec_pushf(&fastexport->args, "--import-marks=%s", data->import_marks); for (i = 0; i < revlist_args->nr; i++) - argv_array_push(&fastexport->args, revlist_args->items[i].string); + strvec_push(&fastexport->args, revlist_args->items[i].string); fastexport->git_cmd = 1; return start_command(fastexport); @@ -1082,7 +1082,7 @@ static int has_attribute(const char *attrs, const char *attr) } static struct ref *get_refs_list(struct transport *transport, int for_push, - const struct argv_array *ref_prefixes) + const struct strvec *ref_prefixes) { get_helper(transport); diff --git a/transport-internal.h b/transport-internal.h index 284784a2a6..27c9daffc4 100644 --- a/transport-internal.h +++ b/transport-internal.h @@ -30,7 +30,7 @@ struct transport_vtable { * in the ref's old_sha1 field; otherwise it should be all 0. **/ struct ref *(*get_refs_list)(struct transport *transport, int for_push, - const struct argv_array *ref_prefixes); + const struct strvec *ref_prefixes); /** * Fetch the objects for the given refs. Note that this gets diff --git a/transport.c b/transport.c index b41386eccb..2d4fd851dc 100644 --- a/transport.c +++ b/transport.c @@ -127,7 +127,7 @@ struct bundle_transport_data { static struct ref *get_refs_from_bundle(struct transport *transport, int for_push, - const struct argv_array *ref_prefixes) + const struct strvec *ref_prefixes) { struct bundle_transport_data *data = transport->data; struct ref *result = NULL; @@ -283,7 +283,7 @@ static void die_if_server_options(struct transport *transport) * remote refs. */ static struct ref *handshake(struct transport *transport, int for_push, - const struct argv_array *ref_prefixes, + const struct strvec *ref_prefixes, int must_list_refs) { struct git_transport_data *data = transport->data; @@ -327,7 +327,7 @@ static struct ref *handshake(struct transport *transport, int for_push, } static struct ref *get_refs_via_connect(struct transport *transport, int for_push, - const struct argv_array *ref_prefixes) + const struct strvec *ref_prefixes) { return handshake(transport, for_push, ref_prefixes, 1); } @@ -1153,7 +1153,7 @@ int transport_push(struct repository *r, int porcelain = flags & TRANSPORT_PUSH_PORCELAIN; int pretend = flags & TRANSPORT_PUSH_DRY_RUN; int push_ret, ret, err; - struct argv_array ref_prefixes = ARGV_ARRAY_INIT; + struct strvec ref_prefixes = STRVEC_INIT; if (check_push_refs(local_refs, rs) < 0) return -1; @@ -1165,7 +1165,7 @@ int transport_push(struct repository *r, &ref_prefixes); trace2_region_leave("transport_push", "get_refs_list", r); - argv_array_clear(&ref_prefixes); + strvec_clear(&ref_prefixes); if (flags & TRANSPORT_PUSH_ALL) match_flags |= MATCH_REFS_ALL; @@ -1281,7 +1281,7 @@ int transport_push(struct repository *r, } const struct ref *transport_get_remote_refs(struct transport *transport, - const struct argv_array *ref_prefixes) + const struct strvec *ref_prefixes) { if (!transport->got_remote_refs) { transport->remote_refs = diff --git a/transport.h b/transport.h index b3c30133ea..1be4013dec 100644 --- a/transport.h +++ b/transport.h @@ -243,7 +243,7 @@ int transport_push(struct repository *repo, * ref_prefixes. */ const struct ref *transport_get_remote_refs(struct transport *transport, - const struct argv_array *ref_prefixes); + const struct strvec *ref_prefixes); /* * Fetch the hash algorithm used by a remote. diff --git a/unpack-trees.c b/unpack-trees.c index 65c3395f0f..323280dd48 100644 --- a/unpack-trees.c +++ b/unpack-trees.c @@ -106,7 +106,7 @@ void setup_unpack_trees_porcelain(struct unpack_trees_options *opts, const char **msgs = opts->msgs; const char *msg; - argv_array_init(&opts->msgs_to_free); + strvec_init(&opts->msgs_to_free); if (!strcmp(cmd, "checkout")) msg = advice_commit_before_merge @@ -124,7 +124,7 @@ void setup_unpack_trees_porcelain(struct unpack_trees_options *opts, "Please commit your changes or stash them before you %s.") : _("Your local changes to the following files would be overwritten by %s:\n%%s"); msgs[ERROR_WOULD_OVERWRITE] = msgs[ERROR_NOT_UPTODATE_FILE] = - argv_array_pushf(&opts->msgs_to_free, msg, cmd, cmd); + strvec_pushf(&opts->msgs_to_free, msg, cmd, cmd); msgs[ERROR_NOT_UPTODATE_DIR] = _("Updating the following directories would lose untracked files in them:\n%s"); @@ -145,7 +145,7 @@ void setup_unpack_trees_porcelain(struct unpack_trees_options *opts, "Please move or remove them before you %s.") : _("The following untracked working tree files would be removed by %s:\n%%s"); msgs[ERROR_WOULD_LOSE_UNTRACKED_REMOVED] = - argv_array_pushf(&opts->msgs_to_free, msg, cmd, cmd); + strvec_pushf(&opts->msgs_to_free, msg, cmd, cmd); if (!strcmp(cmd, "checkout")) msg = advice_commit_before_merge @@ -163,7 +163,7 @@ void setup_unpack_trees_porcelain(struct unpack_trees_options *opts, "Please move or remove them before you %s.") : _("The following untracked working tree files would be overwritten by %s:\n%%s"); msgs[ERROR_WOULD_LOSE_UNTRACKED_OVERWRITTEN] = - argv_array_pushf(&opts->msgs_to_free, msg, cmd, cmd); + strvec_pushf(&opts->msgs_to_free, msg, cmd, cmd); /* * Special case: ERROR_BIND_OVERLAP refers to a pair of paths, we @@ -189,7 +189,7 @@ void setup_unpack_trees_porcelain(struct unpack_trees_options *opts, void clear_unpack_trees_porcelain(struct unpack_trees_options *opts) { - argv_array_clear(&opts->msgs_to_free); + strvec_clear(&opts->msgs_to_free); memset(opts->msgs, 0, sizeof(opts->msgs)); } diff --git a/unpack-trees.h b/unpack-trees.h index f8a904a05b..2e87875b15 100644 --- a/unpack-trees.h +++ b/unpack-trees.h @@ -70,7 +70,7 @@ struct unpack_trees_options { struct pathspec *pathspec; merge_fn_t fn; const char *msgs[NB_UNPACK_TREES_WARNING_TYPES]; - struct argv_array msgs_to_free; + struct strvec msgs_to_free; /* * Store error messages in an array, each case * corresponding to a error message type diff --git a/upload-pack.c b/upload-pack.c index b435dae62f..1b0e1fca1a 100644 --- a/upload-pack.c +++ b/upload-pack.c @@ -269,45 +269,45 @@ static void create_pack_file(struct upload_pack_data *pack_data, if (!pack_data->pack_objects_hook) pack_objects.git_cmd = 1; else { - argv_array_push(&pack_objects.args, pack_data->pack_objects_hook); - argv_array_push(&pack_objects.args, "git"); + strvec_push(&pack_objects.args, pack_data->pack_objects_hook); + strvec_push(&pack_objects.args, "git"); pack_objects.use_shell = 1; } if (pack_data->shallow_nr) { - argv_array_push(&pack_objects.args, "--shallow-file"); - argv_array_push(&pack_objects.args, ""); + strvec_push(&pack_objects.args, "--shallow-file"); + strvec_push(&pack_objects.args, ""); } - argv_array_push(&pack_objects.args, "pack-objects"); - argv_array_push(&pack_objects.args, "--revs"); + strvec_push(&pack_objects.args, "pack-objects"); + strvec_push(&pack_objects.args, "--revs"); if (pack_data->use_thin_pack) - argv_array_push(&pack_objects.args, "--thin"); + strvec_push(&pack_objects.args, "--thin"); - argv_array_push(&pack_objects.args, "--stdout"); + strvec_push(&pack_objects.args, "--stdout"); if (pack_data->shallow_nr) - argv_array_push(&pack_objects.args, "--shallow"); + strvec_push(&pack_objects.args, "--shallow"); if (!pack_data->no_progress) - argv_array_push(&pack_objects.args, "--progress"); + strvec_push(&pack_objects.args, "--progress"); if (pack_data->use_ofs_delta) - argv_array_push(&pack_objects.args, "--delta-base-offset"); + strvec_push(&pack_objects.args, "--delta-base-offset"); if (pack_data->use_include_tag) - argv_array_push(&pack_objects.args, "--include-tag"); + strvec_push(&pack_objects.args, "--include-tag"); if (pack_data->filter_options.choice) { const char *spec = expand_list_objects_filter_spec(&pack_data->filter_options); if (pack_objects.use_shell) { struct strbuf buf = STRBUF_INIT; sq_quote_buf(&buf, spec); - argv_array_pushf(&pack_objects.args, "--filter=%s", buf.buf); + strvec_pushf(&pack_objects.args, "--filter=%s", buf.buf); strbuf_release(&buf); } else { - argv_array_pushf(&pack_objects.args, "--filter=%s", + strvec_pushf(&pack_objects.args, "--filter=%s", spec); } } if (uri_protocols) { for (i = 0; i < uri_protocols->nr; i++) - argv_array_pushf(&pack_objects.args, "--uri-protocol=%s", + strvec_pushf(&pack_objects.args, "--uri-protocol=%s", uri_protocols->items[i].string); } @@ -880,26 +880,26 @@ static int send_shallow_list(struct upload_pack_data *data) deepen(data, data->depth); ret = 1; } else if (data->deepen_rev_list) { - struct argv_array av = ARGV_ARRAY_INIT; + struct strvec av = STRVEC_INIT; int i; - argv_array_push(&av, "rev-list"); + strvec_push(&av, "rev-list"); if (data->deepen_since) - argv_array_pushf(&av, "--max-age=%"PRItime, data->deepen_since); + strvec_pushf(&av, "--max-age=%"PRItime, data->deepen_since); if (data->deepen_not.nr) { - argv_array_push(&av, "--not"); + strvec_push(&av, "--not"); for (i = 0; i < data->deepen_not.nr; i++) { struct string_list_item *s = data->deepen_not.items + i; - argv_array_push(&av, s->string); + strvec_push(&av, s->string); } - argv_array_push(&av, "--not"); + strvec_push(&av, "--not"); } for (i = 0; i < data->want_obj.nr; i++) { struct object *o = data->want_obj.objects[i].item; - argv_array_push(&av, oid_to_hex(&o->oid)); + strvec_push(&av, oid_to_hex(&o->oid)); } deepen_by_rev_list(data, av.argc, av.argv); - argv_array_clear(&av); + strvec_clear(&av); ret = 1; } else { if (data->shallows.nr > 0) { @@ -1521,7 +1521,7 @@ enum fetch_state { FETCH_DONE, }; -int upload_pack_v2(struct repository *r, struct argv_array *keys, +int upload_pack_v2(struct repository *r, struct strvec *keys, struct packet_reader *request) { enum fetch_state state = FETCH_PROCESS_ARGS; diff --git a/wt-status.c b/wt-status.c index 9817161da4..60d4e847a5 100644 --- a/wt-status.c +++ b/wt-status.c @@ -913,17 +913,17 @@ static void wt_longstatus_print_submodule_summary(struct wt_status *s, int uncom struct strbuf summary = STRBUF_INIT; char *summary_content; - argv_array_pushf(&sm_summary.env_array, "GIT_INDEX_FILE=%s", + strvec_pushf(&sm_summary.env_array, "GIT_INDEX_FILE=%s", s->index_file); - argv_array_push(&sm_summary.args, "submodule"); - argv_array_push(&sm_summary.args, "summary"); - argv_array_push(&sm_summary.args, uncommitted ? "--files" : "--cached"); - argv_array_push(&sm_summary.args, "--for-status"); - argv_array_push(&sm_summary.args, "--summary-limit"); - argv_array_pushf(&sm_summary.args, "%d", s->submodule_summary); + strvec_push(&sm_summary.args, "submodule"); + strvec_push(&sm_summary.args, "summary"); + strvec_push(&sm_summary.args, uncommitted ? "--files" : "--cached"); + strvec_push(&sm_summary.args, "--for-status"); + strvec_push(&sm_summary.args, "--summary-limit"); + strvec_pushf(&sm_summary.args, "%d", s->submodule_summary); if (!uncommitted) - argv_array_push(&sm_summary.args, s->amend ? "HEAD^" : "HEAD"); + strvec_push(&sm_summary.args, s->amend ? "HEAD^" : "HEAD"); sm_summary.git_cmd = 1; sm_summary.no_stdin = 1; -- cgit v1.2.3 From f6d8942b1fc6c968980c8ae03054d7b2114b4415 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Tue, 28 Jul 2020 16:26:31 -0400 Subject: strvec: fix indentation in renamed calls Code which split an argv_array call across multiple lines, like: argv_array_pushl(&args, "one argument", "another argument", "and more", NULL); was recently mechanically renamed to use strvec, which results in mis-matched indentation like: strvec_pushl(&args, "one argument", "another argument", "and more", NULL); Let's fix these up to align the arguments with the opening paren. I did this manually by sifting through the results of: git jump grep 'strvec_.*,$' and liberally applying my editor's auto-format. Most of the changes are of the form shown above, though I also normalized a few that had originally used a single-tab indentation (rather than our usual style of aligning with the open paren). I also rewrapped a couple of obvious cases (e.g., where previously too-long lines became short enough to fit on one), but I wasn't aggressive about it. In cases broken to three or more lines, the grouping of arguments is sometimes meaningful, and it wasn't worth my time or reviewer time to ponder each case individually. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- add-interactive.c | 10 +++++----- add-patch.c | 10 +++++----- bisect.c | 2 +- builtin/bisect--helper.c | 2 +- builtin/describe.c | 8 ++++---- builtin/difftool.c | 12 ++++++------ builtin/fetch.c | 2 +- builtin/gc.c | 2 +- builtin/pull.c | 6 +++--- builtin/rebase.c | 14 +++++++------- builtin/receive-pack.c | 42 +++++++++++++++++++++--------------------- builtin/repack.c | 8 ++++---- builtin/stash.c | 38 +++++++++++++++++++------------------- builtin/submodule--helper.c | 20 ++++++++++---------- builtin/worktree.c | 18 +++++++++--------- bundle.c | 10 +++++----- connect.c | 7 ++++--- connected.c | 2 +- daemon.c | 6 +++--- fetch-pack.c | 12 ++++++------ gpg-interface.c | 14 +++++++------- http-backend.c | 2 +- http-push.c | 2 +- http.c | 2 +- range-diff.c | 28 ++++++++++++++-------------- refspec.c | 4 ++-- remote-curl.c | 8 ++++---- remote.c | 4 ++-- sequencer.c | 8 ++++---- submodule.c | 30 +++++++++++++++--------------- t/helper/test-run-command.c | 6 +++--- transport-helper.c | 2 +- upload-pack.c | 3 +-- wt-status.c | 3 +-- 34 files changed, 173 insertions(+), 174 deletions(-) (limited to 'refspec.c') diff --git a/add-interactive.c b/add-interactive.c index b345777d0c..458f3a3e69 100644 --- a/add-interactive.c +++ b/add-interactive.c @@ -941,7 +941,7 @@ static int run_patch(struct add_i_state *s, const struct pathspec *ps, for (i = 0; i < files->items.nr; i++) if (files->selected[i]) strvec_push(&args, - files->items.items[i].string); + files->items.items[i].string); parse_pathspec(&ps_selected, PATHSPEC_ALL_MAGIC & ~PATHSPEC_LITERAL, PATHSPEC_LITERAL_PATH, "", args.argv); @@ -979,13 +979,13 @@ static int run_diff(struct add_i_state *s, const struct pathspec *ps, struct strvec args = STRVEC_INIT; strvec_pushl(&args, "git", "diff", "-p", "--cached", - oid_to_hex(!is_initial ? &oid : - s->r->hash_algo->empty_tree), - "--", NULL); + oid_to_hex(!is_initial ? &oid : + s->r->hash_algo->empty_tree), + "--", NULL); for (i = 0; i < files->items.nr; i++) if (files->selected[i]) strvec_push(&args, - files->items.items[i].string); + files->items.items[i].string); res = run_command_v_opt(args.argv, 0); strvec_clear(&args); } diff --git a/add-patch.c b/add-patch.c index 3c91ae52ae..8c0772803b 100644 --- a/add-patch.c +++ b/add-patch.c @@ -291,7 +291,7 @@ static void setup_child_process(struct add_p_state *s, cp->git_cmd = 1; strvec_pushf(&cp->env_array, - INDEX_ENVIRONMENT "=%s", s->s.r->index_file); + INDEX_ENVIRONMENT "=%s", s->s.r->index_file); } static int parse_range(const char **p, @@ -386,10 +386,10 @@ static int parse_diff(struct add_p_state *s, const struct pathspec *ps) if (s->revision) { struct object_id oid; strvec_push(&args, - /* could be on an unborn branch */ - !strcmp("HEAD", s->revision) && - get_oid("HEAD", &oid) ? - empty_tree_oid_hex() : s->revision); + /* could be on an unborn branch */ + !strcmp("HEAD", s->revision) && + get_oid("HEAD", &oid) ? + empty_tree_oid_hex() : s->revision); } color_arg_index = args.argc; /* Use `--no-color` explicitly, just in case `diff.color = always`. */ diff --git a/bisect.c b/bisect.c index 3e50b51c11..99ff694960 100644 --- a/bisect.c +++ b/bisect.c @@ -644,7 +644,7 @@ static void bisect_rev_setup(struct repository *r, struct rev_info *revs, strvec_pushf(&rev_argv, bad_format, oid_to_hex(current_bad_oid)); for (i = 0; i < good_revs.nr; i++) strvec_pushf(&rev_argv, good_format, - oid_to_hex(good_revs.oid + i)); + oid_to_hex(good_revs.oid + i)); strvec_push(&rev_argv, "--"); if (read_paths) read_bisect_paths(&rev_argv); diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 9815e78871..dd52878413 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -529,7 +529,7 @@ static int bisect_start(struct bisect_terms *terms, int no_checkout, struct strvec argv = STRVEC_INIT; strvec_pushl(&argv, "checkout", start_head.buf, - "--", NULL); + "--", NULL); if (run_command_v_opt(argv.argv, RUN_GIT_CMD)) { res = error(_("checking out '%s' failed." " Try 'git bisect start " diff --git a/builtin/describe.c b/builtin/describe.c index ff3c169fa9..e3cac8002c 100644 --- a/builtin/describe.c +++ b/builtin/describe.c @@ -505,8 +505,8 @@ static void describe_blob(struct object_id oid, struct strbuf *dst) struct process_commit_data pcd = { null_oid, oid, dst, &revs}; strvec_pushl(&args, "internal: The first arg is not parsed", - "--objects", "--in-commit-order", "--reverse", "HEAD", - NULL); + "--objects", "--in-commit-order", "--reverse", "HEAD", + NULL); repo_init_revisions(the_repository, &revs, NULL); if (setup_revisions(args.argc, args.argv, &revs, NULL) > 1) @@ -598,8 +598,8 @@ int cmd_describe(int argc, const char **argv, const char *prefix) strvec_init(&args); strvec_pushl(&args, "name-rev", - "--peel-tag", "--name-only", "--no-undefined", - NULL); + "--peel-tag", "--name-only", "--no-undefined", + NULL); if (always) strvec_push(&args, "--always"); if (!all) { diff --git a/builtin/difftool.c b/builtin/difftool.c index 40c4d7b6b6..5ac021a1d4 100644 --- a/builtin/difftool.c +++ b/builtin/difftool.c @@ -211,9 +211,9 @@ static void changed_files(struct hashmap *result, const char *index_path, env[0] = index_env.buf; strvec_pushl(&update_index.args, - "--git-dir", git_dir, "--work-tree", workdir, - "update-index", "--really-refresh", "-q", - "--unmerged", NULL); + "--git-dir", git_dir, "--work-tree", workdir, + "update-index", "--really-refresh", "-q", + "--unmerged", NULL); update_index.no_stdin = 1; update_index.no_stdout = 1; update_index.no_stderr = 1; @@ -226,8 +226,8 @@ static void changed_files(struct hashmap *result, const char *index_path, run_command(&update_index); strvec_pushl(&diff_files.args, - "--git-dir", git_dir, "--work-tree", workdir, - "diff-files", "--name-only", "-z", NULL); + "--git-dir", git_dir, "--work-tree", workdir, + "diff-files", "--name-only", "-z", NULL); diff_files.no_stdin = 1; diff_files.git_cmd = 1; diff_files.use_shell = 0; @@ -394,7 +394,7 @@ static int run_dir_diff(const char *extcmd, int symlinks, const char *prefix, child.dir = prefix; child.out = -1; strvec_pushl(&child.args, "diff", "--raw", "--no-abbrev", "-z", - NULL); + NULL); for (i = 0; i < argc; i++) strvec_push(&child.args, argv[i]); if (start_command(&child)) diff --git a/builtin/fetch.c b/builtin/fetch.c index cc636188ad..c2e7afeb6a 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -1601,7 +1601,7 @@ static int fetch_multiple(struct string_list *list, int max_children) } strvec_pushl(&argv, "fetch", "--append", "--no-auto-gc", - "--no-write-commit-graph", NULL); + "--no-write-commit-graph", NULL); add_options_to_argv(&argv); if (max_children != 1 && list->nr != 1) { diff --git a/builtin/gc.c b/builtin/gc.c index 89742e159e..98719800a3 100644 --- a/builtin/gc.c +++ b/builtin/gc.c @@ -662,7 +662,7 @@ int cmd_gc(int argc, const char **argv, const char *prefix) strvec_push(&prune, "--no-progress"); if (has_promisor_remote()) strvec_push(&prune, - "--exclude-promisor-objects"); + "--exclude-promisor-objects"); if (run_command_v_opt(prune.argv, RUN_GIT_CMD)) die(FAILED_RUN, prune.argv[0]); } diff --git a/builtin/pull.c b/builtin/pull.c index 8a8d30e1dc..dae8766646 100644 --- a/builtin/pull.c +++ b/builtin/pull.c @@ -638,7 +638,7 @@ static int rebase_submodules(void) cp.git_cmd = 1; cp.no_stdin = 1; strvec_pushl(&cp.args, "submodule", "update", - "--recursive", "--rebase", NULL); + "--recursive", "--rebase", NULL); argv_push_verbosity(&cp.args); return run_command(&cp); @@ -651,7 +651,7 @@ static int update_submodules(void) cp.git_cmd = 1; cp.no_stdin = 1; strvec_pushl(&cp.args, "submodule", "update", - "--recursive", "--checkout", NULL); + "--recursive", "--checkout", NULL); argv_push_verbosity(&cp.args); return run_command(&cp); @@ -802,7 +802,7 @@ static int get_rebase_fork_point(struct object_id *fork_point, const char *repo, return -1; strvec_pushl(&cp.args, "merge-base", "--fork-point", - remote_branch, curr_branch->name, NULL); + remote_branch, curr_branch->name, NULL); cp.no_stdin = 1; cp.no_stderr = 1; cp.git_cmd = 1; diff --git a/builtin/rebase.c b/builtin/rebase.c index fb56b9e263..35aeb8effc 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -348,7 +348,7 @@ static int do_interactive_rebase(struct rebase_options *opts, unsigned flags) strvec_pushl(&make_script_args, "", revisions, NULL); if (opts->restrict_revision) strvec_pushf(&make_script_args, "^%s", - oid_to_hex(&opts->restrict_revision->object.oid)); + oid_to_hex(&opts->restrict_revision->object.oid)); ret = sequencer_make_script(the_repository, &todo_list.buf, make_script_args.argc, make_script_args.argv, @@ -858,17 +858,17 @@ static int run_am(struct rebase_options *opts) format_patch.git_cmd = 1; strvec_pushl(&format_patch.args, "format-patch", "-k", "--stdout", - "--full-index", "--cherry-pick", "--right-only", - "--src-prefix=a/", "--dst-prefix=b/", "--no-renames", - "--no-cover-letter", "--pretty=mboxrd", "--topo-order", - "--no-base", NULL); + "--full-index", "--cherry-pick", "--right-only", + "--src-prefix=a/", "--dst-prefix=b/", "--no-renames", + "--no-cover-letter", "--pretty=mboxrd", "--topo-order", + "--no-base", NULL); if (opts->git_format_patch_opt.len) strvec_split(&format_patch.args, - opts->git_format_patch_opt.buf); + opts->git_format_patch_opt.buf); strvec_push(&format_patch.args, revisions.buf); if (opts->restrict_revision) strvec_pushf(&format_patch.args, "^%s", - oid_to_hex(&opts->restrict_revision->object.oid)); + oid_to_hex(&opts->restrict_revision->object.oid)); status = run_command(&format_patch); if (status) { diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c index 71274231aa..1fc69cf5bc 100644 --- a/builtin/receive-pack.c +++ b/builtin/receive-pack.c @@ -668,24 +668,24 @@ static void prepare_push_cert_sha1(struct child_process *proc) } if (!is_null_oid(&push_cert_oid)) { strvec_pushf(&proc->env_array, "GIT_PUSH_CERT=%s", - oid_to_hex(&push_cert_oid)); + oid_to_hex(&push_cert_oid)); strvec_pushf(&proc->env_array, "GIT_PUSH_CERT_SIGNER=%s", - sigcheck.signer ? sigcheck.signer : ""); + sigcheck.signer ? sigcheck.signer : ""); strvec_pushf(&proc->env_array, "GIT_PUSH_CERT_KEY=%s", - sigcheck.key ? sigcheck.key : ""); + sigcheck.key ? sigcheck.key : ""); strvec_pushf(&proc->env_array, "GIT_PUSH_CERT_STATUS=%c", - sigcheck.result); + sigcheck.result); if (push_cert_nonce) { strvec_pushf(&proc->env_array, - "GIT_PUSH_CERT_NONCE=%s", - push_cert_nonce); + "GIT_PUSH_CERT_NONCE=%s", + push_cert_nonce); strvec_pushf(&proc->env_array, - "GIT_PUSH_CERT_NONCE_STATUS=%s", - nonce_status); + "GIT_PUSH_CERT_NONCE_STATUS=%s", + nonce_status); if (nonce_status == NONCE_SLOP) strvec_pushf(&proc->env_array, - "GIT_PUSH_CERT_NONCE_SLOP=%ld", - nonce_stamp_slop); + "GIT_PUSH_CERT_NONCE_SLOP=%ld", + nonce_stamp_slop); } } } @@ -721,10 +721,10 @@ static int run_and_feed_hook(const char *hook_name, feed_fn feed, int i; for (i = 0; i < feed_state->push_options->nr; i++) strvec_pushf(&proc.env_array, - "GIT_PUSH_OPTION_%d=%s", i, - feed_state->push_options->items[i].string); + "GIT_PUSH_OPTION_%d=%s", i, + feed_state->push_options->items[i].string); strvec_pushf(&proc.env_array, "GIT_PUSH_OPTION_COUNT=%d", - feed_state->push_options->nr); + feed_state->push_options->nr); } else strvec_pushf(&proc.env_array, "GIT_PUSH_OPTION_COUNT"); @@ -1718,7 +1718,7 @@ static const char *pack_lockfile; static void push_header_arg(struct strvec *args, struct pack_header *hdr) { strvec_pushf(args, "--pack_header=%"PRIu32",%"PRIu32, - ntohl(hdr->hdr_version), ntohl(hdr->hdr_entries)); + ntohl(hdr->hdr_version), ntohl(hdr->hdr_entries)); } static const char *unpack(int err_fd, struct shallow_info *si) @@ -1768,10 +1768,10 @@ static const char *unpack(int err_fd, struct shallow_info *si) strvec_push(&child.args, "-q"); if (fsck_objects) strvec_pushf(&child.args, "--strict%s", - fsck_msg_types.buf); + fsck_msg_types.buf); if (max_input_size) strvec_pushf(&child.args, "--max-input-size=%"PRIuMAX, - (uintmax_t)max_input_size); + (uintmax_t)max_input_size); child.no_stdout = 1; child.err = err_fd; child.git_cmd = 1; @@ -1787,9 +1787,9 @@ static const char *unpack(int err_fd, struct shallow_info *si) if (xgethostname(hostname, sizeof(hostname))) xsnprintf(hostname, sizeof(hostname), "localhost"); strvec_pushf(&child.args, - "--keep=receive-pack %"PRIuMAX" on %s", - (uintmax_t)getpid(), - hostname); + "--keep=receive-pack %"PRIuMAX" on %s", + (uintmax_t)getpid(), + hostname); if (!quiet && err_fd) strvec_push(&child.args, "--show-resolving-progress"); @@ -1797,12 +1797,12 @@ static const char *unpack(int err_fd, struct shallow_info *si) strvec_push(&child.args, "--report-end-of-input"); if (fsck_objects) strvec_pushf(&child.args, "--strict%s", - fsck_msg_types.buf); + fsck_msg_types.buf); if (!reject_thin) strvec_push(&child.args, "--fix-thin"); if (max_input_size) strvec_pushf(&child.args, "--max-input-size=%"PRIuMAX, - (uintmax_t)max_input_size); + (uintmax_t)max_input_size); child.out = -1; child.err = err_fd; child.git_cmd = 1; diff --git a/builtin/repack.c b/builtin/repack.c index 7435ee9af1..04c5ceaf7e 100644 --- a/builtin/repack.c +++ b/builtin/repack.c @@ -366,7 +366,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix) strvec_push(&cmd.args, "--honor-pack-keep"); for (i = 0; i < keep_pack_list.nr; i++) strvec_pushf(&cmd.args, "--keep-pack=%s", - keep_pack_list.items[i].string); + keep_pack_list.items[i].string); strvec_push(&cmd.args, "--non-empty"); strvec_push(&cmd.args, "--all"); strvec_push(&cmd.args, "--reflog"); @@ -388,12 +388,12 @@ int cmd_repack(int argc, const char **argv, const char *prefix) if (existing_packs.nr && delete_redundant) { if (unpack_unreachable) { strvec_pushf(&cmd.args, - "--unpack-unreachable=%s", - unpack_unreachable); + "--unpack-unreachable=%s", + unpack_unreachable); strvec_push(&cmd.env_array, "GIT_REF_PARANOIA=1"); } else if (pack_everything & LOOSEN_UNREACHABLE) { strvec_push(&cmd.args, - "--unpack-unreachable"); + "--unpack-unreachable"); } else if (keep_unreachable) { strvec_push(&cmd.args, "--keep-unreachable"); strvec_push(&cmd.args, "--pack-loose-unreachable"); diff --git a/builtin/stash.c b/builtin/stash.c index 05c086e54c..bfdbafae89 100644 --- a/builtin/stash.c +++ b/builtin/stash.c @@ -336,7 +336,7 @@ static int get_newly_staged(struct strbuf *out, struct object_id *c_tree) */ cp.git_cmd = 1; strvec_pushl(&cp.args, "diff-index", "--cached", "--name-only", - "--diff-filter=A", NULL); + "--diff-filter=A", NULL); strvec_push(&cp.args, c_tree_hex); return pipe_command(&cp, NULL, 0, out, 0, NULL, 0); } @@ -368,7 +368,7 @@ static int restore_untracked(struct object_id *u_tree) strvec_push(&cp.args, "read-tree"); strvec_push(&cp.args, oid_to_hex(u_tree)); strvec_pushf(&cp.env_array, "GIT_INDEX_FILE=%s", - stash_index_path.buf); + stash_index_path.buf); if (run_command(&cp)) { remove_path(stash_index_path.buf); return -1; @@ -378,7 +378,7 @@ static int restore_untracked(struct object_id *u_tree) cp.git_cmd = 1; strvec_pushl(&cp.args, "checkout-index", "--all", NULL); strvec_pushf(&cp.env_array, "GIT_INDEX_FILE=%s", - stash_index_path.buf); + stash_index_path.buf); res = run_command(&cp); remove_path(stash_index_path.buf); @@ -500,9 +500,9 @@ static int do_apply_stash(const char *prefix, struct stash_info *info, cp.git_cmd = 1; cp.dir = prefix; strvec_pushf(&cp.env_array, GIT_WORK_TREE_ENVIRONMENT"=%s", - absolute_path(get_git_work_tree())); + absolute_path(get_git_work_tree())); strvec_pushf(&cp.env_array, GIT_DIR_ENVIRONMENT"=%s", - absolute_path(get_git_dir())); + absolute_path(get_git_dir())); strvec_push(&cp.args, "status"); run_command(&cp); } @@ -547,7 +547,7 @@ static int do_drop_stash(struct stash_info *info, int quiet) cp_reflog.git_cmd = 1; strvec_pushl(&cp_reflog.args, "reflog", "delete", "--updateref", - "--rewrite", NULL); + "--rewrite", NULL); strvec_push(&cp_reflog.args, info->revision.buf); ret = run_command(&cp_reflog); if (!ret) { @@ -693,7 +693,7 @@ static int list_stash(int argc, const char **argv, const char *prefix) cp.git_cmd = 1; strvec_pushl(&cp.args, "log", "--format=%gd: %gs", "-g", - "--first-parent", "-m", NULL); + "--first-parent", "-m", NULL); strvec_pushv(&cp.args, argv); strvec_push(&cp.args, ref_stash); strvec_push(&cp.args, "--"); @@ -961,7 +961,7 @@ static int save_untracked_files(struct stash_info *info, struct strbuf *msg, cp_upd_index.git_cmd = 1; strvec_pushl(&cp_upd_index.args, "update-index", "-z", "--add", - "--remove", "--stdin", NULL); + "--remove", "--stdin", NULL); strvec_pushf(&cp_upd_index.env_array, "GIT_INDEX_FILE=%s", stash_index_path.buf); @@ -1005,7 +1005,7 @@ static int stash_patch(struct stash_info *info, const struct pathspec *ps, cp_read_tree.git_cmd = 1; strvec_pushl(&cp_read_tree.args, "read-tree", "HEAD", NULL); strvec_pushf(&cp_read_tree.env_array, "GIT_INDEX_FILE=%s", - stash_index_path.buf); + stash_index_path.buf); if (run_command(&cp_read_tree)) { ret = -1; goto done; @@ -1035,7 +1035,7 @@ static int stash_patch(struct stash_info *info, const struct pathspec *ps, cp_diff_tree.git_cmd = 1; strvec_pushl(&cp_diff_tree.args, "diff-tree", "-p", "-U1", "HEAD", - oid_to_hex(&info->w_tree), "--", NULL); + oid_to_hex(&info->w_tree), "--", NULL); if (pipe_command(&cp_diff_tree, NULL, 0, out_patch, 0, NULL, 0)) { ret = -1; goto done; @@ -1089,10 +1089,10 @@ static int stash_working_tree(struct stash_info *info, const struct pathspec *ps cp_upd_index.git_cmd = 1; strvec_pushl(&cp_upd_index.args, "update-index", - "--ignore-skip-worktree-entries", - "-z", "--add", "--remove", "--stdin", NULL); + "--ignore-skip-worktree-entries", + "-z", "--add", "--remove", "--stdin", NULL); strvec_pushf(&cp_upd_index.env_array, "GIT_INDEX_FILE=%s", - stash_index_path.buf); + stash_index_path.buf); if (pipe_command(&cp_upd_index, diff_output.buf, diff_output.len, NULL, 0, NULL, 0)) { @@ -1343,7 +1343,7 @@ static int do_push_stash(const struct pathspec *ps, const char *stash_msg, int q cp.git_cmd = 1; strvec_pushl(&cp.args, "clean", "--force", - "--quiet", "-d", NULL); + "--quiet", "-d", NULL); if (include_untracked == INCLUDE_ALL_FILES) strvec_push(&cp.args, "-x"); if (run_command(&cp)) { @@ -1373,8 +1373,8 @@ static int do_push_stash(const struct pathspec *ps, const char *stash_msg, int q cp_diff.git_cmd = 1; strvec_pushl(&cp_diff.args, "diff-index", "-p", - "--cached", "--binary", "HEAD", "--", - NULL); + "--cached", "--binary", "HEAD", "--", + NULL); add_pathspecs(&cp_diff.args, ps); if (pipe_command(&cp_diff, NULL, 0, &out, 0, NULL, 0)) { ret = -1; @@ -1383,7 +1383,7 @@ static int do_push_stash(const struct pathspec *ps, const char *stash_msg, int q cp_apply.git_cmd = 1; strvec_pushl(&cp_apply.args, "apply", "--index", - "-R", NULL); + "-R", NULL); if (pipe_command(&cp_apply, out.buf, out.len, NULL, 0, NULL, 0)) { ret = -1; @@ -1393,7 +1393,7 @@ static int do_push_stash(const struct pathspec *ps, const char *stash_msg, int q struct child_process cp = CHILD_PROCESS_INIT; cp.git_cmd = 1; strvec_pushl(&cp.args, "reset", "--hard", "-q", - "--no-recurse-submodules", NULL); + "--no-recurse-submodules", NULL); if (run_command(&cp)) { ret = -1; goto done; @@ -1405,7 +1405,7 @@ static int do_push_stash(const struct pathspec *ps, const char *stash_msg, int q cp.git_cmd = 1; strvec_pushl(&cp.args, "checkout", "--no-overlay", - oid_to_hex(&info.i_tree), "--", NULL); + oid_to_hex(&info.i_tree), "--", NULL); if (!ps->nr) strvec_push(&cp.args, ":/"); else diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index 7705e8eabf..665db1ffed 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -499,7 +499,7 @@ static void runcommand_in_submodule_cb(const struct cache_entry *list_item, strvec_pushf(&cp.env_array, "sm_path=%s", path); strvec_pushf(&cp.env_array, "displaypath=%s", displaypath); strvec_pushf(&cp.env_array, "sha1=%s", - oid_to_hex(ce_oid)); + oid_to_hex(ce_oid)); strvec_pushf(&cp.env_array, "toplevel=%s", toplevel); /* @@ -513,7 +513,7 @@ static void runcommand_in_submodule_cb(const struct cache_entry *list_item, */ sq_quote_buf(&sb, path); strvec_pushf(&cp.args, "path=%s; %s", - sb.buf, info->argv[0]); + sb.buf, info->argv[0]); strbuf_release(&sb); free(toplevel); } else { @@ -537,7 +537,7 @@ static void runcommand_in_submodule_cb(const struct cache_entry *list_item, strvec_pushl(&cpr.args, "--super-prefix", NULL); strvec_pushf(&cpr.args, "%s/", displaypath); strvec_pushl(&cpr.args, "submodule--helper", "foreach", "--recursive", - NULL); + NULL); if (info->quiet) strvec_push(&cpr.args, "--quiet"); @@ -810,8 +810,8 @@ static void status_submodule(const char *path, const struct object_id *ce_oid, strbuf_release(&buf); strvec_pushl(&diff_files_args, "diff-files", - "--ignore-submodules=dirty", "--quiet", "--", - path, NULL); + "--ignore-submodules=dirty", "--quiet", "--", + path, NULL); git_config(git_diff_basic_config, NULL); @@ -852,7 +852,7 @@ static void status_submodule(const char *path, const struct object_id *ce_oid, strvec_push(&cpr.args, "--super-prefix"); strvec_pushf(&cpr.args, "%s/", displaypath); strvec_pushl(&cpr.args, "submodule--helper", "status", - "--recursive", NULL); + "--recursive", NULL); if (flags & OPT_CACHED) strvec_push(&cpr.args, "--cached"); @@ -996,7 +996,7 @@ static void sync_submodule(const char *path, const char *prefix, cp.git_cmd = 1; cp.dir = path; strvec_pushl(&cp.args, "submodule--helper", - "print-default-remote", NULL); + "print-default-remote", NULL); strbuf_reset(&sb); if (capture_command(&cp, &sb, 0)) @@ -1024,7 +1024,7 @@ static void sync_submodule(const char *path, const char *prefix, strvec_push(&cpr.args, "--super-prefix"); strvec_pushf(&cpr.args, "%s/", displaypath); strvec_pushl(&cpr.args, "submodule--helper", "sync", - "--recursive", NULL); + "--recursive", NULL); if (flags & OPT_QUIET) strvec_push(&cpr.args, "--quiet"); @@ -1128,7 +1128,7 @@ static void deinit_submodule(const char *path, const char *prefix, struct child_process cp_rm = CHILD_PROCESS_INIT; cp_rm.git_cmd = 1; strvec_pushl(&cp_rm.args, "rm", "-qn", - path, NULL); + path, NULL); if (run_command(&cp_rm)) die(_("Submodule work tree '%s' contains local " @@ -1251,7 +1251,7 @@ static int clone_submodule(const char *path, const char *gitdir, const char *url struct string_list_item *item; for_each_string_list_item(item, reference) strvec_pushl(&cp.args, "--reference", - item->string, NULL); + item->string, NULL); } if (dissociate) strvec_push(&cp.args, "--dissociate"); diff --git a/builtin/worktree.c b/builtin/worktree.c index 3c483c23d4..be5d84f0a0 100644 --- a/builtin/worktree.c +++ b/builtin/worktree.c @@ -414,10 +414,10 @@ static int add_worktree(const char *path, const char *refname, if (!is_branch) strvec_pushl(&cp.args, "update-ref", "HEAD", - oid_to_hex(&commit->object.oid), NULL); + oid_to_hex(&commit->object.oid), NULL); else { strvec_pushl(&cp.args, "symbolic-ref", "HEAD", - symref.buf, NULL); + symref.buf, NULL); if (opts->quiet) strvec_push(&cp.args, "--quiet"); } @@ -466,9 +466,9 @@ done: cp.argv = NULL; cp.trace2_hook_name = "post-checkout"; strvec_pushl(&cp.args, absolute_path(hook), - oid_to_hex(&null_oid), - oid_to_hex(&commit->object.oid), - "1", NULL); + oid_to_hex(&null_oid), + oid_to_hex(&commit->object.oid), + "1", NULL); ret = run_command(&cp); } } @@ -936,13 +936,13 @@ static void check_clean_worktree(struct worktree *wt, validate_no_submodules(wt); strvec_pushf(&child_env, "%s=%s/.git", - GIT_DIR_ENVIRONMENT, wt->path); + GIT_DIR_ENVIRONMENT, wt->path); strvec_pushf(&child_env, "%s=%s", - GIT_WORK_TREE_ENVIRONMENT, wt->path); + GIT_WORK_TREE_ENVIRONMENT, wt->path); memset(&cp, 0, sizeof(cp)); strvec_pushl(&cp.args, "status", - "--porcelain", "--ignore-submodules=none", - NULL); + "--porcelain", "--ignore-submodules=none", + NULL); cp.env = child_env.argv; cp.git_cmd = 1; cp.dir = wt->path; diff --git a/bundle.c b/bundle.c index 709b2abc9c..565d05367f 100644 --- a/bundle.c +++ b/bundle.c @@ -275,9 +275,9 @@ static int write_pack_data(int bundle_fd, struct rev_info *revs, struct strvec * int i; strvec_pushl(&pack_objects.args, - "pack-objects", - "--stdout", "--thin", "--delta-base-offset", - NULL); + "pack-objects", + "--stdout", "--thin", "--delta-base-offset", + NULL); strvec_pushv(&pack_objects.args, pack_options->argv); pack_objects.in = -1; pack_objects.out = bundle_fd; @@ -322,8 +322,8 @@ static int compute_and_write_prerequisites(int bundle_fd, int i; strvec_pushl(&rls.args, - "rev-list", "--boundary", "--pretty=oneline", - NULL); + "rev-list", "--boundary", "--pretty=oneline", + NULL); for (i = 1; i < argc; i++) strvec_push(&rls.args, argv[i]); rls.out = -1; diff --git a/connect.c b/connect.c index 9b453fe792..3299ea956a 100644 --- a/connect.c +++ b/connect.c @@ -1208,7 +1208,7 @@ static void push_ssh_options(struct strvec *args, struct strvec *env, strvec_push(args, "-o"); strvec_push(args, "SendEnv=" GIT_PROTOCOL_ENVIRONMENT); strvec_pushf(env, GIT_PROTOCOL_ENVIRONMENT "=version=%d", - version); + version); } if (flags & CONNECT_IPV4) { @@ -1397,8 +1397,9 @@ struct child_process *git_connect(int fd[2], const char *url, transport_check_allowed("file"); conn->trace2_child_class = "transport/file"; if (version > 0) { - strvec_pushf(&conn->env_array, GIT_PROTOCOL_ENVIRONMENT "=version=%d", - version); + strvec_pushf(&conn->env_array, + GIT_PROTOCOL_ENVIRONMENT "=version=%d", + version); } } strvec_push(&conn->args, cmd.buf); diff --git a/connected.c b/connected.c index 96b47879d3..21c1ebe9fb 100644 --- a/connected.c +++ b/connected.c @@ -106,7 +106,7 @@ no_promisor_pack_found: strvec_push(&rev_list.args, "--alternate-refs"); if (opt->progress) strvec_pushf(&rev_list.args, "--progress=%s", - _("Checking connectivity")); + _("Checking connectivity")); rev_list.git_cmd = 1; rev_list.env = opt->env; diff --git a/daemon.c b/daemon.c index cea5f5354f..0dec89fa02 100644 --- a/daemon.c +++ b/daemon.c @@ -665,7 +665,7 @@ static void parse_extra_args(struct hostinfo *hi, struct strvec *env, if (git_protocol.len > 0) { loginfo("Extended attribute \"protocol\": %s", git_protocol.buf); strvec_pushf(env, GIT_PROTOCOL_ENVIRONMENT "=%s", - git_protocol.buf); + git_protocol.buf); } strbuf_release(&git_protocol); } @@ -915,7 +915,7 @@ static void handle(int incoming, struct sockaddr *addr, socklen_t addrlen) inet_ntop(addr->sa_family, &sin_addr->sin_addr, buf, sizeof(buf)); strvec_pushf(&cld.env_array, "REMOTE_ADDR=%s", buf); strvec_pushf(&cld.env_array, "REMOTE_PORT=%d", - ntohs(sin_addr->sin_port)); + ntohs(sin_addr->sin_port)); #ifndef NO_IPV6 } else if (addr->sa_family == AF_INET6) { char buf[128] = ""; @@ -923,7 +923,7 @@ static void handle(int incoming, struct sockaddr *addr, socklen_t addrlen) inet_ntop(AF_INET6, &sin6_addr->sin6_addr, buf, sizeof(buf)); strvec_pushf(&cld.env_array, "REMOTE_ADDR=[%s]", buf); strvec_pushf(&cld.env_array, "REMOTE_PORT=%d", - ntohs(sin6_addr->sin6_port)); + ntohs(sin6_addr->sin6_port)); #endif } diff --git a/fetch-pack.c b/fetch-pack.c index 7aa5dfbdad..7f20eca4f8 100644 --- a/fetch-pack.c +++ b/fetch-pack.c @@ -854,8 +854,8 @@ static int get_pack(struct fetch_pack_args *args, if (xgethostname(hostname, sizeof(hostname))) xsnprintf(hostname, sizeof(hostname), "localhost"); strvec_pushf(&cmd.args, - "--keep=fetch-pack %"PRIuMAX " on %s", - (uintmax_t)getpid(), hostname); + "--keep=fetch-pack %"PRIuMAX " on %s", + (uintmax_t)getpid(), hostname); } if (only_packfile && args->check_self_contained_and_connected) strvec_push(&cmd.args, "--check-self-contained-and-connected"); @@ -885,7 +885,7 @@ static int get_pack(struct fetch_pack_args *args, if (pass_header) strvec_pushf(&cmd.args, "--pack_header=%"PRIu32",%"PRIu32, - ntohl(header.hdr_version), + ntohl(header.hdr_version), ntohl(header.hdr_entries)); if (fetch_fsck_objects >= 0 ? fetch_fsck_objects @@ -901,7 +901,7 @@ static int get_pack(struct fetch_pack_args *args, strvec_push(&cmd.args, "--fsck-objects"); else strvec_pushf(&cmd.args, "--strict%s", - fsck_msg_types.buf); + fsck_msg_types.buf); } cmd.in = demux.out; @@ -1654,8 +1654,8 @@ static struct ref *do_fetch_pack_v2(struct fetch_pack_args *args, strvec_push(&cmd.args, "http-fetch"); strvec_pushf(&cmd.args, "--packfile=%.*s", - (int) the_hash_algo->hexsz, - packfile_uris.items[i].string); + (int) the_hash_algo->hexsz, + packfile_uris.items[i].string); strvec_push(&cmd.args, uri); cmd.git_cmd = 1; cmd.no_stdin = 1; diff --git a/gpg-interface.c b/gpg-interface.c index cf56fe838f..b499270836 100644 --- a/gpg-interface.c +++ b/gpg-interface.c @@ -285,9 +285,9 @@ static int verify_signed_buffer(const char *payload, size_t payload_size, strvec_push(&gpg.args, fmt->program); strvec_pushv(&gpg.args, fmt->verify_args); strvec_pushl(&gpg.args, - "--status-fd=1", - "--verify", temp->filename.buf, "-", - NULL); + "--status-fd=1", + "--verify", temp->filename.buf, "-", + NULL); if (!gpg_status) gpg_status = &buf; @@ -435,10 +435,10 @@ int sign_buffer(struct strbuf *buffer, struct strbuf *signature, const char *sig struct strbuf gpg_status = STRBUF_INIT; strvec_pushl(&gpg.args, - use_format->program, - "--status-fd=2", - "-bsau", signing_key, - NULL); + use_format->program, + "--status-fd=2", + "-bsau", signing_key, + NULL); bottom = signature->len; diff --git a/http-backend.c b/http-backend.c index 92fd62f73f..a03b4bae22 100644 --- a/http-backend.c +++ b/http-backend.c @@ -480,7 +480,7 @@ static void run_service(const char **argv, int buffer_input) strvec_pushf(&cld.env_array, "GIT_COMMITTER_NAME=%s", user); if (!getenv("GIT_COMMITTER_EMAIL")) strvec_pushf(&cld.env_array, - "GIT_COMMITTER_EMAIL=%s@http.%s", user, host); + "GIT_COMMITTER_EMAIL=%s@http.%s", user, host); cld.argv = argv; if (buffer_input || gzipped_request || req_len >= 0) diff --git a/http-push.c b/http-push.c index e1deea6fe4..31911aa345 100644 --- a/http-push.c +++ b/http-push.c @@ -1929,7 +1929,7 @@ int cmd_main(int argc, const char **argv) strvec_push(&commit_argv, oid_to_hex(&ref->new_oid)); if (!push_all && !is_null_oid(&ref->old_oid)) strvec_pushf(&commit_argv, "^%s", - oid_to_hex(&ref->old_oid)); + oid_to_hex(&ref->old_oid)); repo_init_revisions(the_repository, &revs, setup_git_directory()); setup_revisions(commit_argv.argc, commit_argv.argv, &revs, NULL); revs.edge_hint = 0; /* just in case */ diff --git a/http.c b/http.c index 268a1e9744..8b23a546af 100644 --- a/http.c +++ b/http.c @@ -2276,7 +2276,7 @@ int finish_http_pack_request(struct http_pack_request *preq) ip.in = tmpfile_fd; if (preq->generate_keep) { strvec_pushf(&ip.args, "--keep=git %"PRIuMAX, - (uintmax_t)getpid()); + (uintmax_t)getpid()); ip.out = 0; } else { ip.no_stdout = 1; diff --git a/range-diff.c b/range-diff.c index 3a0eb70c89..831c490bf2 100644 --- a/range-diff.c +++ b/range-diff.c @@ -52,20 +52,20 @@ static int read_patches(const char *range, struct string_list *list, size_t size; strvec_pushl(&cp.args, "log", "--no-color", "-p", "--no-merges", - "--reverse", "--date-order", "--decorate=no", - "--no-prefix", - /* - * Choose indicators that are not used anywhere - * else in diffs, but still look reasonable - * (e.g. will not be confusing when debugging) - */ - "--output-indicator-new=>", - "--output-indicator-old=<", - "--output-indicator-context=#", - "--no-abbrev-commit", - "--pretty=medium", - "--notes", - NULL); + "--reverse", "--date-order", "--decorate=no", + "--no-prefix", + /* + * Choose indicators that are not used anywhere + * else in diffs, but still look reasonable + * (e.g. will not be confusing when debugging) + */ + "--output-indicator-new=>", + "--output-indicator-old=<", + "--output-indicator-context=#", + "--no-abbrev-commit", + "--pretty=medium", + "--notes", + NULL); if (other_arg) strvec_pushv(&cp.args, other_arg->argv); strvec_push(&cp.args, range); diff --git a/refspec.c b/refspec.c index 6f317d6b44..f10ef284ce 100644 --- a/refspec.c +++ b/refspec.c @@ -222,8 +222,8 @@ void refspec_ref_prefixes(const struct refspec *rs, if (item->pattern) { const char *glob = strchr(prefix, '*'); strvec_pushf(ref_prefixes, "%.*s", - (int)(glob - prefix), - prefix); + (int)(glob - prefix), + prefix); } else { expand_ref_prefix(ref_prefixes, prefix); } diff --git a/remote-curl.c b/remote-curl.c index 85ce4f7e6f..7feaddc003 100644 --- a/remote-curl.c +++ b/remote-curl.c @@ -1145,7 +1145,7 @@ static int fetch_git(struct discovery *heads, struct strbuf rpc_result = STRBUF_INIT; strvec_pushl(&args, "fetch-pack", "--stateless-rpc", - "--stdin", "--lock-pack", NULL); + "--stdin", "--lock-pack", NULL); if (options.followtags) strvec_push(&args, "--include-tag"); if (options.thin) @@ -1166,7 +1166,7 @@ static int fetch_git(struct discovery *heads, strvec_pushf(&args, "--shallow-since=%s", options.deepen_since); for (i = 0; i < options.deepen_not.nr; i++) strvec_pushf(&args, "--shallow-exclude=%s", - options.deepen_not.items[i].string); + options.deepen_not.items[i].string); if (options.deepen_relative && options.depth) strvec_push(&args, "--deepen-relative"); if (options.from_promisor) @@ -1293,7 +1293,7 @@ static int push_git(struct discovery *heads, int nr_spec, const char **specs) strvec_init(&args); strvec_pushl(&args, "send-pack", "--stateless-rpc", "--helper-status", - NULL); + NULL); if (options.thin) strvec_push(&args, "--thin"); @@ -1311,7 +1311,7 @@ static int push_git(struct discovery *heads, int nr_spec, const char **specs) strvec_push(&args, "--verbose"); for (i = 0; i < options.push_options.nr; i++) strvec_pushf(&args, "--push-option=%s", - options.push_options.items[i].string); + options.push_options.items[i].string); strvec_push(&args, options.progress ? "--progress" : "--no-progress"); for_each_string_list_item(cas_option, &cas_options) strvec_push(&args, cas_option->string); diff --git a/remote.c b/remote.c index 13b097866c..b4665fe5a3 100644 --- a/remote.c +++ b/remote.c @@ -1914,8 +1914,8 @@ static int stat_branch_pair(const char *branch_name, const char *base, strvec_push(&argv, ""); /* ignored */ strvec_push(&argv, "--left-right"); strvec_pushf(&argv, "%s...%s", - oid_to_hex(&ours->object.oid), - oid_to_hex(&theirs->object.oid)); + oid_to_hex(&ours->object.oid), + oid_to_hex(&theirs->object.oid)); strvec_push(&argv, "--"); repo_init_revisions(the_repository, &revs, NULL); diff --git a/sequencer.c b/sequencer.c index 80c770968a..31a2b1ab55 100644 --- a/sequencer.c +++ b/sequencer.c @@ -3133,7 +3133,7 @@ static int do_exec(struct repository *r, const char *command_line) child_argv[0] = command_line; strvec_pushf(&child_env, "GIT_DIR=%s", absolute_path(get_git_dir())); strvec_pushf(&child_env, "GIT_WORK_TREE=%s", - absolute_path(get_git_work_tree())); + absolute_path(get_git_work_tree())); status = run_command_v_opt_cd_env(child_argv, RUN_USING_SHELL, NULL, child_env.argv); @@ -3552,7 +3552,7 @@ static int do_merge(struct repository *r, strvec_push(&cmd.args, strategy); for (k = 0; k < opts->xopts_nr; k++) strvec_pushf(&cmd.args, - "-X%s", opts->xopts[k]); + "-X%s", opts->xopts[k]); } strvec_push(&cmd.args, "--no-edit"); strvec_push(&cmd.args, "--no-ff"); @@ -3566,7 +3566,7 @@ static int do_merge(struct repository *r, /* Add the tips to be merged */ for (j = to_merge; j; j = j->next) strvec_push(&cmd.args, - oid_to_hex(&j->item->object.oid)); + oid_to_hex(&j->item->object.oid)); strbuf_release(&ref_name); unlink(git_path_cherry_pick_head(r)); @@ -3695,7 +3695,7 @@ void create_autostash(struct repository *r, const char *path, struct object_id oid; strvec_pushl(&stash.args, - "stash", "create", "autostash", NULL); + "stash", "create", "autostash", NULL); stash.git_cmd = 1; stash.no_stdin = 1; strbuf_reset(&buf); diff --git a/submodule.c b/submodule.c index 5c9447422d..fb96d595b0 100644 --- a/submodule.c +++ b/submodule.c @@ -495,7 +495,7 @@ void prepare_submodule_repo_env(struct strvec *out) { prepare_submodule_repo_env_no_git_dir(out); strvec_pushf(out, "%s=%s", GIT_DIR_ENVIRONMENT, - DEFAULT_GIT_DIR_ENVIRONMENT); + DEFAULT_GIT_DIR_ENVIRONMENT); } static void prepare_submodule_repo_env_in_gitdir(struct strvec *out) @@ -687,14 +687,14 @@ void show_submodule_inline_diff(struct diff_options *o, const char *path, if (o->flags.reverse_diff) { strvec_pushf(&cp.args, "--src-prefix=%s%s/", - o->b_prefix, path); + o->b_prefix, path); strvec_pushf(&cp.args, "--dst-prefix=%s%s/", - o->a_prefix, path); + o->a_prefix, path); } else { strvec_pushf(&cp.args, "--src-prefix=%s%s/", - o->a_prefix, path); + o->a_prefix, path); strvec_pushf(&cp.args, "--dst-prefix=%s%s/", - o->b_prefix, path); + o->b_prefix, path); } strvec_push(&cp.args, oid_to_hex(old_oid)); /* @@ -1062,7 +1062,7 @@ static int push_submodule(const char *path, const struct string_list_item *item; for_each_string_list_item(item, push_options) strvec_pushf(&cp.args, "--push-option=%s", - item->string); + item->string); } if (remote->origin != REMOTE_UNCONFIGURED) { @@ -1780,7 +1780,7 @@ int bad_to_remove_submodule(const char *path, unsigned flags) return 1; strvec_pushl(&cp.args, "status", "--porcelain", - "--ignore-submodules=none", NULL); + "--ignore-submodules=none", NULL); if (flags & SUBMODULE_REMOVAL_IGNORE_UNTRACKED) strvec_push(&cp.args, "-uno"); @@ -1847,7 +1847,7 @@ static int submodule_has_dirty_index(const struct submodule *sub) cp.git_cmd = 1; strvec_pushl(&cp.args, "diff-index", "--quiet", - "--cached", "HEAD", NULL); + "--cached", "HEAD", NULL); cp.no_stdin = 1; cp.no_stdout = 1; cp.dir = sub->path; @@ -1867,7 +1867,7 @@ static void submodule_reset_index(const char *path) cp.dir = path; strvec_pushf(&cp.args, "--super-prefix=%s%s/", - get_super_prefix_or_empty(), path); + get_super_prefix_or_empty(), path); strvec_pushl(&cp.args, "read-tree", "-u", "--reset", NULL); strvec_push(&cp.args, empty_tree_oid_hex()); @@ -1948,7 +1948,7 @@ int submodule_move_head(const char *path, cp.dir = path; strvec_pushf(&cp.args, "--super-prefix=%s%s/", - get_super_prefix_or_empty(), path); + get_super_prefix_or_empty(), path); strvec_pushl(&cp.args, "read-tree", "--recurse-submodules", NULL); if (flags & SUBMODULE_MOVE_HEAD_DRY_RUN) @@ -1981,7 +1981,7 @@ int submodule_move_head(const char *path, prepare_submodule_repo_env(&cp.env_array); strvec_pushl(&cp.args, "update-ref", "HEAD", - "--no-deref", new_head, NULL); + "--no-deref", new_head, NULL); if (run_command(&cp)) { ret = -1; @@ -2158,8 +2158,8 @@ void absorb_git_dir_into_superproject(const char *path, cp.git_cmd = 1; cp.no_stdin = 1; strvec_pushl(&cp.args, "--super-prefix", sb.buf, - "submodule--helper", - "absorb-git-dirs", NULL); + "submodule--helper", + "absorb-git-dirs", NULL); prepare_submodule_repo_env(&cp.env_array); if (run_command(&cp)) die(_("could not recurse into submodule '%s'"), path); @@ -2197,8 +2197,8 @@ int get_superproject_working_tree(struct strbuf *buf) strvec_pop(&cp.env_array); strvec_pushl(&cp.args, "--literal-pathspecs", "-C", "..", - "ls-files", "-z", "--stage", "--full-name", "--", - subpath, NULL); + "ls-files", "-z", "--stage", "--full-name", "--", + subpath, NULL); strbuf_reset(&sb); cp.no_stdin = 1; diff --git a/t/helper/test-run-command.c b/t/helper/test-run-command.c index 67dde56962..726835fcc2 100644 --- a/t/helper/test-run-command.c +++ b/t/helper/test-run-command.c @@ -244,10 +244,10 @@ static int quote_stress_test(int argc, const char **argv) strvec_clear(&args); if (msys2) strvec_pushl(&args, "sh", "-c", - "printf %s\\\\0 \"$@\"", "skip", NULL); + "printf %s\\\\0 \"$@\"", "skip", NULL); else strvec_pushl(&args, "test-tool", "run-command", - "quote-echo", NULL); + "quote-echo", NULL); arg_offset = args.argc; if (argc > 0) { @@ -339,7 +339,7 @@ static int inherit_handle(const char *argv0) tmp = xmkstemp(path); strvec_pushl(&cp.args, - "test-tool", argv0, "inherited-handle-child", NULL); + "test-tool", argv0, "inherited-handle-child", NULL); cp.in = -1; cp.no_stdout = cp.no_stderr = 1; if (start_command(&cp) < 0) diff --git a/transport-helper.c b/transport-helper.c index dcd4adf444..ae8011e9d5 100644 --- a/transport-helper.c +++ b/transport-helper.c @@ -136,7 +136,7 @@ static struct child_process *get_helper(struct transport *transport) if (have_git_dir()) strvec_pushf(&helper->env_array, "%s=%s", - GIT_DIR_ENVIRONMENT, get_git_dir()); + GIT_DIR_ENVIRONMENT, get_git_dir()); helper->trace2_child_class = helper->args.argv[0]; /* "remote-" */ diff --git a/upload-pack.c b/upload-pack.c index 1b0e1fca1a..4a7918e04e 100644 --- a/upload-pack.c +++ b/upload-pack.c @@ -301,8 +301,7 @@ static void create_pack_file(struct upload_pack_data *pack_data, strvec_pushf(&pack_objects.args, "--filter=%s", buf.buf); strbuf_release(&buf); } else { - strvec_pushf(&pack_objects.args, "--filter=%s", - spec); + strvec_pushf(&pack_objects.args, "--filter=%s", spec); } } if (uri_protocols) { diff --git a/wt-status.c b/wt-status.c index 60d4e847a5..8454662c90 100644 --- a/wt-status.c +++ b/wt-status.c @@ -913,8 +913,7 @@ static void wt_longstatus_print_submodule_summary(struct wt_status *s, int uncom struct strbuf summary = STRBUF_INIT; char *summary_content; - strvec_pushf(&sm_summary.env_array, "GIT_INDEX_FILE=%s", - s->index_file); + strvec_pushf(&sm_summary.env_array, "GIT_INDEX_FILE=%s", s->index_file); strvec_push(&sm_summary.args, "submodule"); strvec_push(&sm_summary.args, "summary"); -- cgit v1.2.3