diff options
| author | Junio C Hamano <gitster@pobox.com> | 2024-09-30 16:16:14 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-09-30 16:16:15 -0700 |
| commit | 22baac889235bb3752ae36baec36f345871ac939 (patch) | |
| tree | c933fdde036ec7033b2237c6f0319170638d2554 | |
| parent | ab68c70a8b90626be24d95a27f6495ab6e7e57a5 (diff) | |
| parent | 082caf527ea769635e8c46d0cc181c844c50defd (diff) | |
| download | git-22baac889235bb3752ae36baec36f345871ac939.tar.xz | |
Merge branch 'pw/submodule-process-sigpipe'
When a subprocess to work in a submodule spawned by "git submodule"
fails with SIGPIPE, the parent Git process caught the death of it,
but gave a generic "failed to work in that submodule", which was
misleading. We now behave as if the parent got SIGPIPE and die.
* pw/submodule-process-sigpipe:
submodule status: propagate SIGPIPE
| -rw-r--r-- | builtin/submodule--helper.c | 6 | ||||
| -rwxr-xr-x | t/t7422-submodule-output.sh | 7 |
2 files changed, 12 insertions, 1 deletions
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index a1ada86952..8d36aefbe6 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -696,6 +696,7 @@ static void status_submodule(const char *path, const struct object_id *ce_oid, if (flags & OPT_RECURSIVE) { struct child_process cpr = CHILD_PROCESS_INIT; + int res; cpr.git_cmd = 1; cpr.dir = path; @@ -711,7 +712,10 @@ static void status_submodule(const char *path, const struct object_id *ce_oid, if (flags & OPT_QUIET) strvec_push(&cpr.args, "--quiet"); - if (run_command(&cpr)) + res = run_command(&cpr); + if (res == SIGPIPE + 128) + raise(SIGPIPE); + else if (res) die(_("failed to recurse into submodule '%s'"), path); } diff --git a/t/t7422-submodule-output.sh b/t/t7422-submodule-output.sh index ab946ec940..c1686d6bb5 100755 --- a/t/t7422-submodule-output.sh +++ b/t/t7422-submodule-output.sh @@ -167,4 +167,11 @@ do ' done +test_expect_success !MINGW 'git submodule status --recursive propagates SIGPIPE' ' + { git submodule status --recursive 2>err; echo $?>status; } | + grep -q X/S && + test_must_be_empty err && + test_match_signal 13 "$(cat status)" +' + test_done |
