strvec: rename struct fields
The "argc" and "argv" names made sense when the struct was argv_array, but now they're just confusing. Let's rename them to "nr" (which we use for counts elsewhere) and "v" (which is rather terse, but reads well when combined with typical variable names like "args.v"). Note that we have to update all of the callers immediately. Playing tricks with the preprocessor is hard here, because we wouldn't want to rewrite unrelated tokens. 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
b5eb741a00
commit
d70a9eb611
@ -351,7 +351,7 @@ static int do_interactive_rebase(struct rebase_options *opts, unsigned flags)
|
||||
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,
|
||||
make_script_args.nr, make_script_args.v,
|
||||
flags);
|
||||
|
||||
if (ret)
|
||||
@ -900,7 +900,7 @@ static int run_am(struct rebase_options *opts)
|
||||
return status;
|
||||
}
|
||||
|
||||
strvec_pushv(&am.args, opts->git_am_opts.argv);
|
||||
strvec_pushv(&am.args, opts->git_am_opts.v);
|
||||
strvec_push(&am.args, "--rebasing");
|
||||
strvec_pushf(&am.args, "--resolvemsg=%s", resolvemsg);
|
||||
strvec_push(&am.args, "--patch-format=mboxrd");
|
||||
@ -969,7 +969,7 @@ static int run_specific_rebase(struct rebase_options *opts, enum action action)
|
||||
add_var(&script_snippet, "revisions", opts->revisions);
|
||||
add_var(&script_snippet, "restrict_revision", opts->restrict_revision ?
|
||||
oid_to_hex(&opts->restrict_revision->object.oid) : NULL);
|
||||
sq_quote_argv_pretty(&buf, opts->git_am_opts.argv);
|
||||
sq_quote_argv_pretty(&buf, opts->git_am_opts.v);
|
||||
add_var(&script_snippet, "git_am_opt", buf.buf);
|
||||
strbuf_release(&buf);
|
||||
add_var(&script_snippet, "verbose",
|
||||
@ -1625,8 +1625,8 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
|
||||
allow_preemptive_ff = 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < options.git_am_opts.argc; i++) {
|
||||
const char *option = options.git_am_opts.argv[i], *p;
|
||||
for (i = 0; i < options.git_am_opts.nr; i++) {
|
||||
const char *option = options.git_am_opts.v[i], *p;
|
||||
if (!strcmp(option, "--committer-date-is-author-date") ||
|
||||
!strcmp(option, "--ignore-date") ||
|
||||
!strcmp(option, "--whitespace=fix") ||
|
||||
@ -1721,10 +1721,10 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
|
||||
if (isatty(2) && options.flags & REBASE_NO_QUIET)
|
||||
strbuf_addstr(&options.git_format_patch_opt, " --progress");
|
||||
|
||||
if (options.git_am_opts.argc || options.type == REBASE_APPLY) {
|
||||
if (options.git_am_opts.nr || options.type == REBASE_APPLY) {
|
||||
/* all am options except -q are compatible only with --apply */
|
||||
for (i = options.git_am_opts.argc - 1; i >= 0; i--)
|
||||
if (strcmp(options.git_am_opts.argv[i], "-q"))
|
||||
for (i = options.git_am_opts.nr - 1; i >= 0; i--)
|
||||
if (strcmp(options.git_am_opts.v[i], "-q"))
|
||||
break;
|
||||
|
||||
if (i >= 0) {
|
||||
|
Reference in New Issue
Block a user