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/clone.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/clone.c')
-rw-r--r--builtin/clone.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/builtin/clone.c b/builtin/clone.c
index bef70745c09..e26bd82dc4e 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -742,9 +742,9 @@ static void update_head(const struct ref *our, const struct ref *remote,
static int git_sparse_checkout_init(const char *repo)
{
- struct argv_array argv = ARGV_ARRAY_INIT;
+ struct strvec argv = STRVEC_INIT;
int result = 0;
- argv_array_pushl(&argv, "-C", repo, "sparse-checkout", "init", NULL);
+ strvec_pushl(&argv, "-C", repo, "sparse-checkout", "init", NULL);
/*
* We must apply the setting in the current process
@@ -757,7 +757,7 @@ static int git_sparse_checkout_init(const char *repo)
result = 1;
}
- argv_array_clear(&argv);
+ strvec_clear(&argv);
return result;
}
@@ -819,33 +819,33 @@ static int checkout(int submodule_progress)
oid_to_hex(&oid), "1", NULL);
if (!err && (option_recurse_submodules.nr > 0)) {
- struct argv_array args = ARGV_ARRAY_INIT;
- argv_array_pushl(&args, "submodule", "update", "--require-init", "--recursive", NULL);
+ struct strvec args = STRVEC_INIT;
+ strvec_pushl(&args, "submodule", "update", "--require-init", "--recursive", NULL);
if (option_shallow_submodules == 1)
- argv_array_push(&args, "--depth=1");
+ strvec_push(&args, "--depth=1");
if (max_jobs != -1)
- argv_array_pushf(&args, "--jobs=%d", max_jobs);
+ strvec_pushf(&args, "--jobs=%d", max_jobs);
if (submodule_progress)
- argv_array_push(&args, "--progress");
+ strvec_push(&args, "--progress");
if (option_verbosity < 0)
- argv_array_push(&args, "--quiet");
+ strvec_push(&args, "--quiet");
if (option_remote_submodules) {
- argv_array_push(&args, "--remote");
- argv_array_push(&args, "--no-fetch");
+ strvec_push(&args, "--remote");
+ strvec_push(&args, "--no-fetch");
}
if (option_single_branch >= 0)
- argv_array_push(&args, option_single_branch ?
+ strvec_push(&args, option_single_branch ?
"--single-branch" :
"--no-single-branch");
err = run_command_v_opt(args.argv, RUN_GIT_CMD);
- argv_array_clear(&args);
+ strvec_clear(&args);
}
return err;
@@ -961,7 +961,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
int err = 0, complete_refs_before_fetch = 1;
int submodule_progress;
- struct argv_array ref_prefixes = ARGV_ARRAY_INIT;
+ struct strvec ref_prefixes = STRVEC_INIT;
packet_trace_identity("clone");
argc = parse_options(argc, argv, prefix, builtin_clone_options,
@@ -1211,12 +1211,12 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
transport->smart_options->check_self_contained_and_connected = 1;
- argv_array_push(&ref_prefixes, "HEAD");
+ strvec_push(&ref_prefixes, "HEAD");
refspec_ref_prefixes(&remote->fetch, &ref_prefixes);
if (option_branch)
expand_ref_prefix(&ref_prefixes, option_branch);
if (!option_no_tags)
- argv_array_push(&ref_prefixes, "refs/tags/");
+ strvec_push(&ref_prefixes, "refs/tags/");
refs = transport_get_remote_refs(transport, &ref_prefixes);
@@ -1327,6 +1327,6 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
strbuf_release(&default_refspec);
junk_mode = JUNK_LEAVE_ALL;
- argv_array_clear(&ref_prefixes);
+ strvec_clear(&ref_prefixes);
return err;
}