Skip to content

Commit 22baac8

Browse files
committed
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
2 parents ab68c70 + 082caf5 commit 22baac8

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

builtin/submodule--helper.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,7 @@ static void status_submodule(const char *path, const struct object_id *ce_oid,
696696

697697
if (flags & OPT_RECURSIVE) {
698698
struct child_process cpr = CHILD_PROCESS_INIT;
699+
int res;
699700

700701
cpr.git_cmd = 1;
701702
cpr.dir = path;
@@ -711,7 +712,10 @@ static void status_submodule(const char *path, const struct object_id *ce_oid,
711712
if (flags & OPT_QUIET)
712713
strvec_push(&cpr.args, "--quiet");
713714

714-
if (run_command(&cpr))
715+
res = run_command(&cpr);
716+
if (res == SIGPIPE + 128)
717+
raise(SIGPIPE);
718+
else if (res)
715719
die(_("failed to recurse into submodule '%s'"), path);
716720
}
717721

t/t7422-submodule-output.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,4 +167,11 @@ do
167167
'
168168
done
169169

170+
test_expect_success !MINGW 'git submodule status --recursive propagates SIGPIPE' '
171+
{ git submodule status --recursive 2>err; echo $?>status; } |
172+
grep -q X/S &&
173+
test_must_be_empty err &&
174+
test_match_signal 13 "$(cat status)"
175+
'
176+
170177
test_done

0 commit comments

Comments
 (0)