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>
This commit is contained in:

committed by
Junio C Hamano

parent
2745b6b450
commit
22f9b7f3f5
@ -1451,35 +1451,35 @@ static int update(int argc, const char **argv)
|
||||
N_("prune remotes after fetching")),
|
||||
OPT_END()
|
||||
};
|
||||
struct argv_array fetch_argv = ARGV_ARRAY_INIT;
|
||||
struct strvec fetch_argv = STRVEC_INIT;
|
||||
int default_defined = 0;
|
||||
int retval;
|
||||
|
||||
argc = parse_options(argc, argv, NULL, options, builtin_remote_update_usage,
|
||||
PARSE_OPT_KEEP_ARGV0);
|
||||
|
||||
argv_array_push(&fetch_argv, "fetch");
|
||||
strvec_push(&fetch_argv, "fetch");
|
||||
|
||||
if (prune != -1)
|
||||
argv_array_push(&fetch_argv, prune ? "--prune" : "--no-prune");
|
||||
strvec_push(&fetch_argv, prune ? "--prune" : "--no-prune");
|
||||
if (verbose)
|
||||
argv_array_push(&fetch_argv, "-v");
|
||||
argv_array_push(&fetch_argv, "--multiple");
|
||||
strvec_push(&fetch_argv, "-v");
|
||||
strvec_push(&fetch_argv, "--multiple");
|
||||
if (argc < 2)
|
||||
argv_array_push(&fetch_argv, "default");
|
||||
strvec_push(&fetch_argv, "default");
|
||||
for (i = 1; i < argc; i++)
|
||||
argv_array_push(&fetch_argv, argv[i]);
|
||||
strvec_push(&fetch_argv, argv[i]);
|
||||
|
||||
if (strcmp(fetch_argv.argv[fetch_argv.argc-1], "default") == 0) {
|
||||
git_config(get_remote_default, &default_defined);
|
||||
if (!default_defined) {
|
||||
argv_array_pop(&fetch_argv);
|
||||
argv_array_push(&fetch_argv, "--all");
|
||||
strvec_pop(&fetch_argv);
|
||||
strvec_push(&fetch_argv, "--all");
|
||||
}
|
||||
}
|
||||
|
||||
retval = run_command_v_opt(fetch_argv.argv, RUN_GIT_CMD);
|
||||
argv_array_clear(&fetch_argv);
|
||||
strvec_clear(&fetch_argv);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user