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
This commit is contained in:
commit
71aa6e3d85
12
submodule.c
12
submodule.c
@ -2367,26 +2367,20 @@ void absorb_git_dir_into_superproject(const char *path,
|
||||
|
||||
if (flags & ABSORB_GITDIR_RECURSE_SUBMODULES) {
|
||||
struct child_process cp = CHILD_PROCESS_INIT;
|
||||
struct strbuf sb = STRBUF_INIT;
|
||||
|
||||
if (flags & ~ABSORB_GITDIR_RECURSE_SUBMODULES)
|
||||
BUG("we don't know how to pass the flags down?");
|
||||
|
||||
strbuf_addstr(&sb, get_super_prefix_or_empty());
|
||||
strbuf_addstr(&sb, path);
|
||||
strbuf_addch(&sb, '/');
|
||||
|
||||
cp.dir = path;
|
||||
cp.git_cmd = 1;
|
||||
cp.no_stdin = 1;
|
||||
strvec_pushl(&cp.args, "--super-prefix", sb.buf,
|
||||
"submodule--helper",
|
||||
strvec_pushf(&cp.args, "--super-prefix=%s%s/",
|
||||
get_super_prefix_or_empty(), path);
|
||||
strvec_pushl(&cp.args, "submodule--helper",
|
||||
"absorbgitdirs", NULL);
|
||||
prepare_submodule_repo_env(&cp.env);
|
||||
if (run_command(&cp))
|
||||
die(_("could not recurse into submodule '%s'"), path);
|
||||
|
||||
strbuf_release(&sb);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user