summaryrefslogtreecommitdiff
path: root/add-patch.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2020-07-28 20:37:20 -0400
committerJunio C Hamano <gitster@pobox.com>2020-07-30 19:18:06 -0700
commitd70a9eb611a9d242c1d26847d223b8677609305b (patch)
tree2c7f218e0037607dfbf8c92ef34a5d412ceac78c /add-patch.c
parentb5eb741a00155f888a9a4ced87c840a2b7b04f5a (diff)
downloadgit-d70a9eb611a9d242c1d26847d223b8677609305b.tar.gz
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 'add-patch.c')
-rw-r--r--add-patch.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/add-patch.c b/add-patch.c
index 8c0772803b..0f68eb665e 100644
--- a/add-patch.c
+++ b/add-patch.c
@@ -391,14 +391,14 @@ static int parse_diff(struct add_p_state *s, const struct pathspec *ps)
get_oid("HEAD", &oid) ?
empty_tree_oid_hex() : s->revision);
}
- color_arg_index = args.argc;
+ color_arg_index = args.nr;
/* Use `--no-color` explicitly, just in case `diff.color = always`. */
strvec_pushl(&args, "--no-color", "-p", "--", NULL);
for (i = 0; i < ps->nr; i++)
strvec_push(&args, ps->items[i].original);
setup_child_process(s, &cp, NULL);
- cp.argv = args.argv;
+ cp.argv = args.v;
res = capture_command(&cp, plain, 0);
if (res) {
strvec_clear(&args);
@@ -415,8 +415,8 @@ static int parse_diff(struct add_p_state *s, const struct pathspec *ps)
const char *diff_filter = s->s.interactive_diff_filter;
setup_child_process(s, &colored_cp, NULL);
- xsnprintf((char *)args.argv[color_arg_index], 8, "--color");
- colored_cp.argv = args.argv;
+ xsnprintf((char *)args.v[color_arg_index], 8, "--color");
+ colored_cp.argv = args.v;
colored = &s->colored;
res = capture_command(&colored_cp, colored, 0);
strvec_clear(&args);