summaryrefslogtreecommitdiff
path: root/submodule.c
diff options
context:
space:
mode:
authorStefan Beller <sbeller@google.com>2016-12-20 23:20:10 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-12-27 22:19:35 (GMT)
commit5a1c824f70ec261f8f9e5e039555fc80301dee0b (patch)
treeee2f538c633b4f709e887b7753f8b3400d6b0a7c /submodule.c
parentbd26756112c0b9394f0aea0a77e7f713ffb0cd00 (diff)
downloadgit-5a1c824f70ec261f8f9e5e039555fc80301dee0b.zip
git-5a1c824f70ec261f8f9e5e039555fc80301dee0b.tar.gz
git-5a1c824f70ec261f8f9e5e039555fc80301dee0b.tar.bz2
submodule: modernize ok_to_remove_submodule to use argv_array
Instead of constructing the NULL terminated array ourselves, we should make use of the argv_array infrastructure. While at it, adapt the error messages to reflect the actual invocation. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'submodule.c')
-rw-r--r--submodule.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/submodule.c b/submodule.c
index 45ccfb7..9f0b544 100644
--- a/submodule.c
+++ b/submodule.c
@@ -1023,13 +1023,6 @@ int ok_to_remove_submodule(const char *path)
{
ssize_t len;
struct child_process cp = CHILD_PROCESS_INIT;
- const char *argv[] = {
- "status",
- "--porcelain",
- "-u",
- "--ignore-submodules=none",
- NULL,
- };
struct strbuf buf = STRBUF_INIT;
int ok_to_remove = 1;
@@ -1039,14 +1032,15 @@ int ok_to_remove_submodule(const char *path)
if (!submodule_uses_gitfile(path))
return 0;
- cp.argv = argv;
+ argv_array_pushl(&cp.args, "status", "--porcelain", "-u",
+ "--ignore-submodules=none", NULL);
prepare_submodule_repo_env(&cp.env_array);
cp.git_cmd = 1;
cp.no_stdin = 1;
cp.out = -1;
cp.dir = path;
if (start_command(&cp))
- die("Could not run 'git status --porcelain -uall --ignore-submodules=none' in submodule %s", path);
+ die(_("could not run 'git status --porcelain -u --ignore-submodules=none' in submodule %s"), path);
len = strbuf_read(&buf, cp.out, 1024);
if (len > 2)
@@ -1054,7 +1048,7 @@ int ok_to_remove_submodule(const char *path)
close(cp.out);
if (finish_command(&cp))
- die("'git status --porcelain -uall --ignore-submodules=none' failed in submodule %s", path);
+ die(_("'git status --porcelain -u --ignore-submodules=none' failed in submodule %s"), path);
strbuf_release(&buf);
return ok_to_remove;