Skip to content

Commit 4b837f8

Browse files
rscharfegitster
authored andcommitted
submodule--helper: use strvec_pushf() for --super-prefix
Use the strvec_pushf() call that already appends a slash to also produce the stuck form of the option --super-prefix instead of adding the option name in a separate call of strvec_push() or strvec_pushl(). This way we can more easily see that these parts make up a single option with its argument and save a function call. Signed-off-by: René Scharfe <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 09e5e7f commit 4b837f8

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

builtin/submodule--helper.c

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -379,8 +379,7 @@ static void runcommand_in_submodule_cb(const struct cache_entry *list_item,
379379

380380
strvec_pushl(&cpr.args, "submodule--helper", "foreach", "--recursive",
381381
NULL);
382-
strvec_pushl(&cpr.args, "--super-prefix", NULL);
383-
strvec_pushf(&cpr.args, "%s/", displaypath);
382+
strvec_pushf(&cpr.args, "--super-prefix=%s/", displaypath);
384383

385384
if (info->quiet)
386385
strvec_push(&cpr.args, "--quiet");
@@ -704,8 +703,7 @@ static void status_submodule(const char *path, const struct object_id *ce_oid,
704703

705704
strvec_pushl(&cpr.args, "submodule--helper", "status",
706705
"--recursive", NULL);
707-
strvec_push(&cpr.args, "--super-prefix");
708-
strvec_pushf(&cpr.args, "%s/", displaypath);
706+
strvec_pushf(&cpr.args, "--super-prefix=%s/", displaypath);
709707

710708
if (flags & OPT_CACHED)
711709
strvec_push(&cpr.args, "--cached");
@@ -1305,9 +1303,7 @@ static void sync_submodule(const char *path, const char *prefix,
13051303

13061304
strvec_pushl(&cpr.args, "submodule--helper", "sync",
13071305
"--recursive", NULL);
1308-
strvec_push(&cpr.args, "--super-prefix");
1309-
strvec_pushf(&cpr.args, "%s/", displaypath);
1310-
1306+
strvec_pushf(&cpr.args, "--super-prefix=%s/", displaypath);
13111307

13121308
if (flags & OPT_QUIET)
13131309
strvec_push(&cpr.args, "--quiet");
@@ -2533,10 +2529,9 @@ static void update_data_to_args(const struct update_data *update_data,
25332529
enum submodule_update_type update_type = update_data->update_default;
25342530

25352531
strvec_pushl(args, "submodule--helper", "update", "--recursive", NULL);
2536-
if (update_data->displaypath) {
2537-
strvec_push(args, "--super-prefix");
2538-
strvec_pushf(args, "%s/", update_data->displaypath);
2539-
}
2532+
if (update_data->displaypath)
2533+
strvec_pushf(args, "--super-prefix=%s/",
2534+
update_data->displaypath);
25402535
strvec_pushf(args, "--jobs=%d", update_data->max_jobs);
25412536
if (update_data->quiet)
25422537
strvec_push(args, "--quiet");

0 commit comments

Comments
 (0)