summaryrefslogtreecommitdiff
path: root/submodule.c
diff options
context:
space:
mode:
authorTaylor Blau <me@ttaylorr.com>2022-10-31 01:04:42 (GMT)
committerTaylor Blau <me@ttaylorr.com>2022-10-31 01:04:42 (GMT)
commit71aa6e3d85eb033ec3300298a132d7898d9969bb (patch)
tree8f9363679706463e3d4c9f2b7e37c22a3b6eab81 /submodule.c
parentc88895e67b0f7bfd9aff603e57e16dcb3a803d1e (diff)
parentcdc3db33ced095ab49c047040da19485bfad2afe (diff)
downloadgit-71aa6e3d85eb033ec3300298a132d7898d9969bb.zip
git-71aa6e3d85eb033ec3300298a132d7898d9969bb.tar.gz
git-71aa6e3d85eb033ec3300298a132d7898d9969bb.tar.bz2
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
Diffstat (limited to 'submodule.c')
-rw-r--r--submodule.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/submodule.c b/submodule.c
index f7c71f1..b958162 100644
--- a/submodule.c
+++ b/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);
}
}