Skip to content

Commit 71aa6e3

Browse files
committed
Merge branch 'rs/absorb-git-dir-simplify'
Code simplification by using strvec_pushf() instead of building an argument in a separate strbuf. * rs/absorb-git-dir-simplify: submodule: use strvec_pushf() for --super-prefix
2 parents c88895e + cdc3db3 commit 71aa6e3

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

submodule.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2367,26 +2367,20 @@ void absorb_git_dir_into_superproject(const char *path,
23672367

23682368
if (flags & ABSORB_GITDIR_RECURSE_SUBMODULES) {
23692369
struct child_process cp = CHILD_PROCESS_INIT;
2370-
struct strbuf sb = STRBUF_INIT;
23712370

23722371
if (flags & ~ABSORB_GITDIR_RECURSE_SUBMODULES)
23732372
BUG("we don't know how to pass the flags down?");
23742373

2375-
strbuf_addstr(&sb, get_super_prefix_or_empty());
2376-
strbuf_addstr(&sb, path);
2377-
strbuf_addch(&sb, '/');
2378-
23792374
cp.dir = path;
23802375
cp.git_cmd = 1;
23812376
cp.no_stdin = 1;
2382-
strvec_pushl(&cp.args, "--super-prefix", sb.buf,
2383-
"submodule--helper",
2377+
strvec_pushf(&cp.args, "--super-prefix=%s%s/",
2378+
get_super_prefix_or_empty(), path);
2379+
strvec_pushl(&cp.args, "submodule--helper",
23842380
"absorbgitdirs", NULL);
23852381
prepare_submodule_repo_env(&cp.env);
23862382
if (run_command(&cp))
23872383
die(_("could not recurse into submodule '%s'"), path);
2388-
2389-
strbuf_release(&sb);
23902384
}
23912385
}
23922386

0 commit comments

Comments
 (0)