Skip to content

Commit f6d8942

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c972bf4 commit f6d8942

34 files changed

+173
-174
lines changed

add-interactive.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -941,7 +941,7 @@ static int run_patch(struct add_i_state *s, const struct pathspec *ps,
941941
for (i = 0; i < files->items.nr; i++)
942942
if (files->selected[i])
943943
strvec_push(&args,
944-
files->items.items[i].string);
944+
files->items.items[i].string);
945945
parse_pathspec(&ps_selected,
946946
PATHSPEC_ALL_MAGIC & ~PATHSPEC_LITERAL,
947947
PATHSPEC_LITERAL_PATH, "", args.argv);
@@ -979,13 +979,13 @@ static int run_diff(struct add_i_state *s, const struct pathspec *ps,
979979
struct strvec args = STRVEC_INIT;
980980

981981
strvec_pushl(&args, "git", "diff", "-p", "--cached",
982-
oid_to_hex(!is_initial ? &oid :
983-
s->r->hash_algo->empty_tree),
984-
"--", NULL);
982+
oid_to_hex(!is_initial ? &oid :
983+
s->r->hash_algo->empty_tree),
984+
"--", NULL);
985985
for (i = 0; i < files->items.nr; i++)
986986
if (files->selected[i])
987987
strvec_push(&args,
988-
files->items.items[i].string);
988+
files->items.items[i].string);
989989
res = run_command_v_opt(args.argv, 0);
990990
strvec_clear(&args);
991991
}

add-patch.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ static void setup_child_process(struct add_p_state *s,
291291

292292
cp->git_cmd = 1;
293293
strvec_pushf(&cp->env_array,
294-
INDEX_ENVIRONMENT "=%s", s->s.r->index_file);
294+
INDEX_ENVIRONMENT "=%s", s->s.r->index_file);
295295
}
296296

297297
static int parse_range(const char **p,
@@ -386,10 +386,10 @@ static int parse_diff(struct add_p_state *s, const struct pathspec *ps)
386386
if (s->revision) {
387387
struct object_id oid;
388388
strvec_push(&args,
389-
/* could be on an unborn branch */
390-
!strcmp("HEAD", s->revision) &&
391-
get_oid("HEAD", &oid) ?
392-
empty_tree_oid_hex() : s->revision);
389+
/* could be on an unborn branch */
390+
!strcmp("HEAD", s->revision) &&
391+
get_oid("HEAD", &oid) ?
392+
empty_tree_oid_hex() : s->revision);
393393
}
394394
color_arg_index = args.argc;
395395
/* Use `--no-color` explicitly, just in case `diff.color = always`. */

bisect.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ static void bisect_rev_setup(struct repository *r, struct rev_info *revs,
644644
strvec_pushf(&rev_argv, bad_format, oid_to_hex(current_bad_oid));
645645
for (i = 0; i < good_revs.nr; i++)
646646
strvec_pushf(&rev_argv, good_format,
647-
oid_to_hex(good_revs.oid + i));
647+
oid_to_hex(good_revs.oid + i));
648648
strvec_push(&rev_argv, "--");
649649
if (read_paths)
650650
read_bisect_paths(&rev_argv);

builtin/bisect--helper.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ static int bisect_start(struct bisect_terms *terms, int no_checkout,
529529
struct strvec argv = STRVEC_INIT;
530530

531531
strvec_pushl(&argv, "checkout", start_head.buf,
532-
"--", NULL);
532+
"--", NULL);
533533
if (run_command_v_opt(argv.argv, RUN_GIT_CMD)) {
534534
res = error(_("checking out '%s' failed."
535535
" Try 'git bisect start "

builtin/describe.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -505,8 +505,8 @@ static void describe_blob(struct object_id oid, struct strbuf *dst)
505505
struct process_commit_data pcd = { null_oid, oid, dst, &revs};
506506

507507
strvec_pushl(&args, "internal: The first arg is not parsed",
508-
"--objects", "--in-commit-order", "--reverse", "HEAD",
509-
NULL);
508+
"--objects", "--in-commit-order", "--reverse", "HEAD",
509+
NULL);
510510

511511
repo_init_revisions(the_repository, &revs, NULL);
512512
if (setup_revisions(args.argc, args.argv, &revs, NULL) > 1)
@@ -598,8 +598,8 @@ int cmd_describe(int argc, const char **argv, const char *prefix)
598598

599599
strvec_init(&args);
600600
strvec_pushl(&args, "name-rev",
601-
"--peel-tag", "--name-only", "--no-undefined",
602-
NULL);
601+
"--peel-tag", "--name-only", "--no-undefined",
602+
NULL);
603603
if (always)
604604
strvec_push(&args, "--always");
605605
if (!all) {

builtin/difftool.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,9 @@ static void changed_files(struct hashmap *result, const char *index_path,
211211
env[0] = index_env.buf;
212212

213213
strvec_pushl(&update_index.args,
214-
"--git-dir", git_dir, "--work-tree", workdir,
215-
"update-index", "--really-refresh", "-q",
216-
"--unmerged", NULL);
214+
"--git-dir", git_dir, "--work-tree", workdir,
215+
"update-index", "--really-refresh", "-q",
216+
"--unmerged", NULL);
217217
update_index.no_stdin = 1;
218218
update_index.no_stdout = 1;
219219
update_index.no_stderr = 1;
@@ -226,8 +226,8 @@ static void changed_files(struct hashmap *result, const char *index_path,
226226
run_command(&update_index);
227227

228228
strvec_pushl(&diff_files.args,
229-
"--git-dir", git_dir, "--work-tree", workdir,
230-
"diff-files", "--name-only", "-z", NULL);
229+
"--git-dir", git_dir, "--work-tree", workdir,
230+
"diff-files", "--name-only", "-z", NULL);
231231
diff_files.no_stdin = 1;
232232
diff_files.git_cmd = 1;
233233
diff_files.use_shell = 0;
@@ -394,7 +394,7 @@ static int run_dir_diff(const char *extcmd, int symlinks, const char *prefix,
394394
child.dir = prefix;
395395
child.out = -1;
396396
strvec_pushl(&child.args, "diff", "--raw", "--no-abbrev", "-z",
397-
NULL);
397+
NULL);
398398
for (i = 0; i < argc; i++)
399399
strvec_push(&child.args, argv[i]);
400400
if (start_command(&child))

builtin/fetch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1601,7 +1601,7 @@ static int fetch_multiple(struct string_list *list, int max_children)
16011601
}
16021602

16031603
strvec_pushl(&argv, "fetch", "--append", "--no-auto-gc",
1604-
"--no-write-commit-graph", NULL);
1604+
"--no-write-commit-graph", NULL);
16051605
add_options_to_argv(&argv);
16061606

16071607
if (max_children != 1 && list->nr != 1) {

builtin/gc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
662662
strvec_push(&prune, "--no-progress");
663663
if (has_promisor_remote())
664664
strvec_push(&prune,
665-
"--exclude-promisor-objects");
665+
"--exclude-promisor-objects");
666666
if (run_command_v_opt(prune.argv, RUN_GIT_CMD))
667667
die(FAILED_RUN, prune.argv[0]);
668668
}

builtin/pull.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ static int rebase_submodules(void)
638638
cp.git_cmd = 1;
639639
cp.no_stdin = 1;
640640
strvec_pushl(&cp.args, "submodule", "update",
641-
"--recursive", "--rebase", NULL);
641+
"--recursive", "--rebase", NULL);
642642
argv_push_verbosity(&cp.args);
643643

644644
return run_command(&cp);
@@ -651,7 +651,7 @@ static int update_submodules(void)
651651
cp.git_cmd = 1;
652652
cp.no_stdin = 1;
653653
strvec_pushl(&cp.args, "submodule", "update",
654-
"--recursive", "--checkout", NULL);
654+
"--recursive", "--checkout", NULL);
655655
argv_push_verbosity(&cp.args);
656656

657657
return run_command(&cp);
@@ -802,7 +802,7 @@ static int get_rebase_fork_point(struct object_id *fork_point, const char *repo,
802802
return -1;
803803

804804
strvec_pushl(&cp.args, "merge-base", "--fork-point",
805-
remote_branch, curr_branch->name, NULL);
805+
remote_branch, curr_branch->name, NULL);
806806
cp.no_stdin = 1;
807807
cp.no_stderr = 1;
808808
cp.git_cmd = 1;

builtin/rebase.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ static int do_interactive_rebase(struct rebase_options *opts, unsigned flags)
348348
strvec_pushl(&make_script_args, "", revisions, NULL);
349349
if (opts->restrict_revision)
350350
strvec_pushf(&make_script_args, "^%s",
351-
oid_to_hex(&opts->restrict_revision->object.oid));
351+
oid_to_hex(&opts->restrict_revision->object.oid));
352352

353353
ret = sequencer_make_script(the_repository, &todo_list.buf,
354354
make_script_args.argc, make_script_args.argv,
@@ -858,17 +858,17 @@ static int run_am(struct rebase_options *opts)
858858

859859
format_patch.git_cmd = 1;
860860
strvec_pushl(&format_patch.args, "format-patch", "-k", "--stdout",
861-
"--full-index", "--cherry-pick", "--right-only",
862-
"--src-prefix=a/", "--dst-prefix=b/", "--no-renames",
863-
"--no-cover-letter", "--pretty=mboxrd", "--topo-order",
864-
"--no-base", NULL);
861+
"--full-index", "--cherry-pick", "--right-only",
862+
"--src-prefix=a/", "--dst-prefix=b/", "--no-renames",
863+
"--no-cover-letter", "--pretty=mboxrd", "--topo-order",
864+
"--no-base", NULL);
865865
if (opts->git_format_patch_opt.len)
866866
strvec_split(&format_patch.args,
867-
opts->git_format_patch_opt.buf);
867+
opts->git_format_patch_opt.buf);
868868
strvec_push(&format_patch.args, revisions.buf);
869869
if (opts->restrict_revision)
870870
strvec_pushf(&format_patch.args, "^%s",
871-
oid_to_hex(&opts->restrict_revision->object.oid));
871+
oid_to_hex(&opts->restrict_revision->object.oid));
872872

873873
status = run_command(&format_patch);
874874
if (status) {

0 commit comments

Comments
 (0)