summaryrefslogtreecommitdiff
path: root/builtin/am.c
diff options
context:
space:
mode:
authorLibravatar Jeff King <peff@peff.net>2020-07-28 20:37:20 -0400
committerLibravatar Junio C Hamano <gitster@pobox.com>2020-07-30 19:18:06 -0700
commitd70a9eb611a9d242c1d26847d223b8677609305b (patch)
tree2c7f218e0037607dfbf8c92ef34a5d412ceac78c /builtin/am.c
parentstrvec: drop argv_array compatibility layer (diff)
downloadtgif-d70a9eb611a9d242c1d26847d223b8677609305b.tar.xz
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>
Diffstat (limited to 'builtin/am.c')
-rw-r--r--builtin/am.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/builtin/am.c b/builtin/am.c
index 992ab3ca27..dd4e6c2d9b 100644
--- a/builtin/am.c
+++ b/builtin/am.c
@@ -812,7 +812,7 @@ static int split_mail_stgit_series(struct am_state *state, const char **paths,
strbuf_release(&sb);
free(series_dir_buf);
- ret = split_mail_conv(stgit_patch_to_mail, state, patches.argv, keep_cr);
+ ret = split_mail_conv(stgit_patch_to_mail, state, patches.v, keep_cr);
strvec_clear(&patches);
return ret;
@@ -1002,7 +1002,7 @@ static void am_setup(struct am_state *state, enum patch_format patch_format,
}
write_state_text(state, "scissors", str);
- sq_quote_argv(&sb, state->git_apply_opts.argv);
+ sq_quote_argv(&sb, state->git_apply_opts.v);
write_state_text(state, "apply-opt", sb.buf);
if (state->rebasing)
@@ -1401,9 +1401,9 @@ static int run_apply(const struct am_state *state, const char *index_file)
BUG("init_apply_state() failed");
strvec_push(&apply_opts, "apply");
- strvec_pushv(&apply_opts, state->git_apply_opts.argv);
+ strvec_pushv(&apply_opts, state->git_apply_opts.v);
- opts_left = apply_parse_options(apply_opts.argc, apply_opts.argv,
+ opts_left = apply_parse_options(apply_opts.nr, apply_opts.v,
&apply_state, &force_apply, &options,
NULL);
@@ -1428,7 +1428,7 @@ static int run_apply(const struct am_state *state, const char *index_file)
strvec_push(&apply_paths, am_path(state, "patch"));
- res = apply_all_patches(&apply_state, apply_paths.argc, apply_paths.argv, options);
+ res = apply_all_patches(&apply_state, apply_paths.nr, apply_paths.v, options);
strvec_clear(&apply_paths);
strvec_clear(&apply_opts);
@@ -1455,7 +1455,7 @@ static int build_fake_ancestor(const struct am_state *state, const char *index_f
cp.git_cmd = 1;
strvec_push(&cp.args, "apply");
- strvec_pushv(&cp.args, state->git_apply_opts.argv);
+ strvec_pushv(&cp.args, state->git_apply_opts.v);
strvec_pushf(&cp.args, "--build-fake-ancestor=%s", index_file);
strvec_push(&cp.args, am_path(state, "patch"));
@@ -2376,10 +2376,10 @@ int cmd_am(int argc, const char **argv, const char *prefix)
strvec_push(&paths, mkpath("%s/%s", prefix, argv[i]));
}
- if (state.interactive && !paths.argc)
+ if (state.interactive && !paths.nr)
die(_("interactive mode requires patches on the command line"));
- am_setup(&state, patch_format, paths.argv, keep_cr);
+ am_setup(&state, patch_format, paths.v, keep_cr);
strvec_clear(&paths);
}