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

github.com/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2020-07-28 23:24:27 +0300
committerJunio C Hamano <gitster@pobox.com>2020-07-29 01:02:18 +0300
commit22f9b7f3f59549735a480042a4b9ce292eedfae0 (patch)
treeaf564ca6084c9790ea99dd60291d7aa9f854fecb /builtin/fetch.c
parent2745b6b4505ae11d6821c1d451169727b558a079 (diff)
strvec: convert builtin/ 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 files in builtin/ to keep the diff to a manageable size. 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; ' and then selectively staging files with "git add builtin/". We'll deal with any indentation/style fallouts separately. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/fetch.c')
-rw-r--r--builtin/fetch.c54
1 files changed, 27 insertions, 27 deletions
diff --git a/builtin/fetch.c b/builtin/fetch.c
index b183b55ee91..cc636188add 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -1316,7 +1316,7 @@ static int do_fetch(struct transport *transport,
int autotags = (transport->remote->fetch_tags == 1);
int retcode = 0;
const struct ref *remote_refs;
- struct argv_array ref_prefixes = ARGV_ARRAY_INIT;
+ struct strvec ref_prefixes = STRVEC_INIT;
int must_list_refs = 1;
if (tags == TAGS_DEFAULT) {
@@ -1355,7 +1355,7 @@ static int do_fetch(struct transport *transport,
if (tags == TAGS_SET || tags == TAGS_DEFAULT) {
must_list_refs = 1;
if (ref_prefixes.argc)
- argv_array_push(&ref_prefixes, "refs/tags/");
+ strvec_push(&ref_prefixes, "refs/tags/");
}
if (must_list_refs) {
@@ -1365,7 +1365,7 @@ static int do_fetch(struct transport *transport,
} else
remote_refs = NULL;
- argv_array_clear(&ref_prefixes);
+ strvec_clear(&ref_prefixes);
ref_map = get_ref_map(transport->remote, remote_refs, rs,
tags, &autotags);
@@ -1503,34 +1503,34 @@ static int add_remote_or_group(const char *name, struct string_list *list)
return 1;
}
-static void add_options_to_argv(struct argv_array *argv)
+static void add_options_to_argv(struct strvec *argv)
{
if (dry_run)
- argv_array_push(argv, "--dry-run");
+ strvec_push(argv, "--dry-run");
if (prune != -1)
- argv_array_push(argv, prune ? "--prune" : "--no-prune");
+ strvec_push(argv, prune ? "--prune" : "--no-prune");
if (prune_tags != -1)
- argv_array_push(argv, prune_tags ? "--prune-tags" : "--no-prune-tags");
+ strvec_push(argv, prune_tags ? "--prune-tags" : "--no-prune-tags");
if (update_head_ok)
- argv_array_push(argv, "--update-head-ok");
+ strvec_push(argv, "--update-head-ok");
if (force)
- argv_array_push(argv, "--force");
+ strvec_push(argv, "--force");
if (keep)
- argv_array_push(argv, "--keep");
+ strvec_push(argv, "--keep");
if (recurse_submodules == RECURSE_SUBMODULES_ON)
- argv_array_push(argv, "--recurse-submodules");
+ strvec_push(argv, "--recurse-submodules");
else if (recurse_submodules == RECURSE_SUBMODULES_ON_DEMAND)
- argv_array_push(argv, "--recurse-submodules=on-demand");
+ strvec_push(argv, "--recurse-submodules=on-demand");
if (tags == TAGS_SET)
- argv_array_push(argv, "--tags");
+ strvec_push(argv, "--tags");
else if (tags == TAGS_UNSET)
- argv_array_push(argv, "--no-tags");
+ strvec_push(argv, "--no-tags");
if (verbosity >= 2)
- argv_array_push(argv, "-v");
+ strvec_push(argv, "-v");
if (verbosity >= 1)
- argv_array_push(argv, "-v");
+ strvec_push(argv, "-v");
else if (verbosity < 0)
- argv_array_push(argv, "-q");
+ strvec_push(argv, "-q");
}
@@ -1554,8 +1554,8 @@ static int fetch_next_remote(struct child_process *cp, struct strbuf *out,
remote = state->remotes->items[state->next++].string;
*task_cb = remote;
- argv_array_pushv(&cp->args, state->argv);
- argv_array_push(&cp->args, remote);
+ strvec_pushv(&cp->args, state->argv);
+ strvec_push(&cp->args, remote);
cp->git_cmd = 1;
if (verbosity >= 0)
@@ -1592,7 +1592,7 @@ static int fetch_finished(int result, struct strbuf *out,
static int fetch_multiple(struct string_list *list, int max_children)
{
int i, result = 0;
- struct argv_array argv = ARGV_ARRAY_INIT;
+ struct strvec argv = STRVEC_INIT;
if (!append && !dry_run) {
int errcode = truncate_fetch_head();
@@ -1600,14 +1600,14 @@ static int fetch_multiple(struct string_list *list, int max_children)
return errcode;
}
- argv_array_pushl(&argv, "fetch", "--append", "--no-auto-gc",
+ strvec_pushl(&argv, "fetch", "--append", "--no-auto-gc",
"--no-write-commit-graph", NULL);
add_options_to_argv(&argv);
if (max_children != 1 && list->nr != 1) {
struct parallel_fetch_state state = { argv.argv, list, 0, 0 };
- argv_array_push(&argv, "--end-of-options");
+ strvec_push(&argv, "--end-of-options");
result = run_processes_parallel_tr2(max_children,
&fetch_next_remote,
&fetch_failed_to_start,
@@ -1620,17 +1620,17 @@ static int fetch_multiple(struct string_list *list, int max_children)
} else
for (i = 0; i < list->nr; i++) {
const char *name = list->items[i].string;
- argv_array_push(&argv, name);
+ strvec_push(&argv, name);
if (verbosity >= 0)
printf(_("Fetching %s\n"), name);
if (run_command_v_opt(argv.argv, RUN_GIT_CMD)) {
error(_("Could not fetch %s"), name);
result = 1;
}
- argv_array_pop(&argv);
+ strvec_pop(&argv);
}
- argv_array_clear(&argv);
+ strvec_clear(&argv);
return !!result;
}
@@ -1844,7 +1844,7 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
}
if (!result && (recurse_submodules != RECURSE_SUBMODULES_OFF)) {
- struct argv_array options = ARGV_ARRAY_INIT;
+ struct strvec options = STRVEC_INIT;
int max_children = max_jobs;
if (max_children < 0)
@@ -1860,7 +1860,7 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
recurse_submodules_default,
verbosity < 0,
max_children);
- argv_array_clear(&options);
+ strvec_clear(&options);
}
string_list_clear(&list, 0);