diff options
author | Junio C Hamano <gitster@pobox.com> | 2020-08-10 10:23:57 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-08-10 10:23:57 -0700 |
commit | 46b225f15308c8f77379f864189bed95c273d29f (patch) | |
tree | 8f909ef2df2d002ccd2c86dc2a9dbdf4aae21c95 /add-interactive.c | |
parent | Fourth batch (diff) | |
parent | strvec: rename struct fields (diff) | |
download | tgif-46b225f15308c8f77379f864189bed95c273d29f.tar.xz |
Merge branch 'jk/strvec'
The argv_array API is useful for not just managing argv but any
"vector" (NULL-terminated array) of strings, and has seen adoption
to a certain degree. It has been renamed to "strvec" to reduce the
barrier to adoption.
* jk/strvec:
strvec: rename struct fields
strvec: drop argv_array compatibility layer
strvec: update documention to avoid argv_array
strvec: fix indentation in renamed calls
strvec: convert remaining callers away from argv_array name
strvec: convert more callers away from argv_array name
strvec: convert builtin/ callers away from argv_array name
quote: rename sq_dequote_to_argv_array to mention strvec
strvec: rename files from argv-array to strvec
argv-array: rename to strvec
argv-array: use size_t for count and alloc
Diffstat (limited to 'add-interactive.c')
-rw-r--r-- | add-interactive.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/add-interactive.c b/add-interactive.c index 29cd2fe020..555c4abf32 100644 --- a/add-interactive.c +++ b/add-interactive.c @@ -935,18 +935,18 @@ static int run_patch(struct add_i_state *s, const struct pathspec *ps, opts->prompt = N_("Patch update"); count = list_and_choose(s, files, opts); if (count > 0) { - struct argv_array args = ARGV_ARRAY_INIT; + struct strvec args = STRVEC_INIT; struct pathspec ps_selected = { 0 }; for (i = 0; i < files->items.nr; i++) if (files->selected[i]) - argv_array_push(&args, - files->items.items[i].string); + strvec_push(&args, + files->items.items[i].string); parse_pathspec(&ps_selected, PATHSPEC_ALL_MAGIC & ~PATHSPEC_LITERAL, - PATHSPEC_LITERAL_PATH, "", args.argv); + PATHSPEC_LITERAL_PATH, "", args.v); res = run_add_p(s->r, ADD_P_ADD, NULL, &ps_selected); - argv_array_clear(&args); + strvec_clear(&args); clear_pathspec(&ps_selected); } @@ -976,18 +976,18 @@ static int run_diff(struct add_i_state *s, const struct pathspec *ps, count = list_and_choose(s, files, opts); opts->flags = 0; if (count > 0) { - struct argv_array args = ARGV_ARRAY_INIT; + struct strvec args = STRVEC_INIT; - argv_array_pushl(&args, "git", "diff", "-p", "--cached", - oid_to_hex(!is_initial ? &oid : - s->r->hash_algo->empty_tree), - "--", NULL); + strvec_pushl(&args, "git", "diff", "-p", "--cached", + oid_to_hex(!is_initial ? &oid : + s->r->hash_algo->empty_tree), + "--", NULL); for (i = 0; i < files->items.nr; i++) if (files->selected[i]) - argv_array_push(&args, - files->items.items[i].string); - res = run_command_v_opt(args.argv, 0); - argv_array_clear(&args); + strvec_push(&args, + files->items.items[i].string); + res = run_command_v_opt(args.v, 0); + strvec_clear(&args); } putchar('\n'); |