Skip to content

Commit 703f159

Browse files
SRabbelierdscho
authored andcommitted
remote-helper: check helper status after import/export
Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Sverre Rabbelier <[email protected]>
1 parent f3f23cc commit 703f159

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

t/t5801-remote-helpers.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ test_expect_success 'push update refs failure' '
236236
echo "update fail" >>file &&
237237
git commit -a -m "update fail" &&
238238
git rev-parse --verify testgit/origin/heads/update >expect &&
239-
test_expect_code 1 env GIT_REMOTE_TESTGIT_FAILURE="non-fast forward" \
239+
test_must_fail env GIT_REMOTE_TESTGIT_FAILURE="non-fast forward" \
240240
git push origin update &&
241241
git rev-parse --verify testgit/origin/heads/update >actual &&
242242
test_cmp expect actual

transport-helper.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,19 @@ static int get_exporter(struct transport *transport,
484484
return start_command(fastexport);
485485
}
486486

487+
static void check_helper_status(struct helper_data *data)
488+
{
489+
int pid, status;
490+
491+
pid = waitpid(data->helper->pid, &status, WNOHANG);
492+
if (pid < 0)
493+
die("Could not retrieve status of remote helper '%s'",
494+
data->name);
495+
if (pid > 0 && WIFEXITED(status))
496+
die("Remote helper '%s' died with %d",
497+
data->name, WEXITSTATUS(status));
498+
}
499+
487500
static int fetch_with_import(struct transport *transport,
488501
int nr_heads, struct ref **to_fetch)
489502
{
@@ -520,6 +533,7 @@ static int fetch_with_import(struct transport *transport,
520533

521534
if (finish_command(&fastimport))
522535
die(_("error while running fast-import"));
536+
check_helper_status(data);
523537

524538
/*
525539
* The fast-import stream of a remote helper that advertises
@@ -1107,6 +1121,7 @@ static int push_refs_with_export(struct transport *transport,
11071121

11081122
if (finish_command(&exporter))
11091123
die(_("error while running fast-export"));
1124+
check_helper_status(data);
11101125
if (push_update_refs_status(data, remote_refs, flags))
11111126
return 1;
11121127

0 commit comments

Comments
 (0)