From dbbcd44fb47347a3fdbee88ea21805b7f4ac0b98 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Tue, 28 Jul 2020 16:23:39 -0400 Subject: strvec: rename files from argv-array to strvec This requires updating #include lines across the code-base, but that's all fairly mechanical, and was done with: git ls-files '*.c' '*.h' | xargs perl -i -pe 's/argv-array.h/strvec.h/' Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- wt-status.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'wt-status.c') diff --git a/wt-status.c b/wt-status.c index c560cbe860..9817161da4 100644 --- a/wt-status.c +++ b/wt-status.c @@ -8,7 +8,7 @@ #include "diffcore.h" #include "quote.h" #include "run-command.h" -#include "argv-array.h" +#include "strvec.h" #include "remote.h" #include "refs.h" #include "submodule.h" -- cgit v1.2.3 From c972bf4cf546a56fe1c54ddde1d33ebb9f454a0f Mon Sep 17 00:00:00 2001 From: Jeff King Date: Tue, 28 Jul 2020 16:25:12 -0400 Subject: strvec: convert remaining 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 remaining files, as the resulting diff is reasonably sized. 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; ' We'll deal with any indentation/style fallouts separately. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- wt-status.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'wt-status.c') diff --git a/wt-status.c b/wt-status.c index 9817161da4..60d4e847a5 100644 --- a/wt-status.c +++ b/wt-status.c @@ -913,17 +913,17 @@ static void wt_longstatus_print_submodule_summary(struct wt_status *s, int uncom struct strbuf summary = STRBUF_INIT; char *summary_content; - argv_array_pushf(&sm_summary.env_array, "GIT_INDEX_FILE=%s", + strvec_pushf(&sm_summary.env_array, "GIT_INDEX_FILE=%s", s->index_file); - argv_array_push(&sm_summary.args, "submodule"); - argv_array_push(&sm_summary.args, "summary"); - argv_array_push(&sm_summary.args, uncommitted ? "--files" : "--cached"); - argv_array_push(&sm_summary.args, "--for-status"); - argv_array_push(&sm_summary.args, "--summary-limit"); - argv_array_pushf(&sm_summary.args, "%d", s->submodule_summary); + strvec_push(&sm_summary.args, "submodule"); + strvec_push(&sm_summary.args, "summary"); + strvec_push(&sm_summary.args, uncommitted ? "--files" : "--cached"); + strvec_push(&sm_summary.args, "--for-status"); + strvec_push(&sm_summary.args, "--summary-limit"); + strvec_pushf(&sm_summary.args, "%d", s->submodule_summary); if (!uncommitted) - argv_array_push(&sm_summary.args, s->amend ? "HEAD^" : "HEAD"); + strvec_push(&sm_summary.args, s->amend ? "HEAD^" : "HEAD"); sm_summary.git_cmd = 1; sm_summary.no_stdin = 1; -- cgit v1.2.3 From f6d8942b1fc6c968980c8ae03054d7b2114b4415 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Tue, 28 Jul 2020 16:26:31 -0400 Subject: strvec: fix indentation in renamed calls Code which split an argv_array call across multiple lines, like: argv_array_pushl(&args, "one argument", "another argument", "and more", NULL); was recently mechanically renamed to use strvec, which results in mis-matched indentation like: strvec_pushl(&args, "one argument", "another argument", "and more", NULL); Let's fix these up to align the arguments with the opening paren. I did this manually by sifting through the results of: git jump grep 'strvec_.*,$' and liberally applying my editor's auto-format. Most of the changes are of the form shown above, though I also normalized a few that had originally used a single-tab indentation (rather than our usual style of aligning with the open paren). I also rewrapped a couple of obvious cases (e.g., where previously too-long lines became short enough to fit on one), but I wasn't aggressive about it. In cases broken to three or more lines, the grouping of arguments is sometimes meaningful, and it wasn't worth my time or reviewer time to ponder each case individually. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- wt-status.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'wt-status.c') diff --git a/wt-status.c b/wt-status.c index 60d4e847a5..8454662c90 100644 --- a/wt-status.c +++ b/wt-status.c @@ -913,8 +913,7 @@ static void wt_longstatus_print_submodule_summary(struct wt_status *s, int uncom struct strbuf summary = STRBUF_INIT; char *summary_content; - strvec_pushf(&sm_summary.env_array, "GIT_INDEX_FILE=%s", - s->index_file); + strvec_pushf(&sm_summary.env_array, "GIT_INDEX_FILE=%s", s->index_file); strvec_push(&sm_summary.args, "submodule"); strvec_push(&sm_summary.args, "summary"); -- cgit v1.2.3