Skip to content

Commit 458f952

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 595fbe4 commit 458f952

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
@@ -239,7 +239,7 @@ test_expect_success 'push update refs failure' '
239239
echo "update fail" >>file &&
240240
git commit -a -m "update fail" &&
241241
git rev-parse --verify testgit/origin/heads/update >expect &&
242-
test_expect_code 1 env GIT_REMOTE_TESTGIT_FAILURE="non-fast forward" \
242+
test_must_fail env GIT_REMOTE_TESTGIT_FAILURE="non-fast forward" \
243243
git push origin update &&
244244
git rev-parse --verify testgit/origin/heads/update >actual &&
245245
test_cmp expect actual

transport-helper.c

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

492+
static void check_helper_status(struct helper_data *data)
493+
{
494+
int pid, status;
495+
496+
pid = waitpid(data->helper->pid, &status, WNOHANG);
497+
if (pid < 0)
498+
die("Could not retrieve status of remote helper '%s'",
499+
data->name);
500+
if (pid > 0 && WIFEXITED(status))
501+
die("Remote helper '%s' died with %d",
502+
data->name, WEXITSTATUS(status));
503+
}
504+
492505
static int fetch_with_import(struct transport *transport,
493506
int nr_heads, struct ref **to_fetch)
494507
{
@@ -525,6 +538,7 @@ static int fetch_with_import(struct transport *transport,
525538

526539
if (finish_command(&fastimport))
527540
die(_("error while running fast-import"));
541+
check_helper_status(data);
528542

529543
/*
530544
* The fast-import stream of a remote helper that advertises
@@ -1129,6 +1143,7 @@ static int push_refs_with_export(struct transport *transport,
11291143

11301144
if (finish_command(&exporter))
11311145
die(_("error while running fast-export"));
1146+
check_helper_status(data);
11321147
if (push_update_refs_status(data, remote_refs, flags))
11331148
return 1;
11341149

0 commit comments

Comments
 (0)