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
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user