Skip to content

Commit 8b51b7a

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 84c0be4 commit 8b51b7a

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
@@ -262,7 +262,7 @@ test_expect_success 'push update refs failure' '
262262
echo "update fail" >>file &&
263263
git commit -a -m "update fail" &&
264264
git rev-parse --verify testgit/origin/heads/update >expect &&
265-
test_expect_code 1 env GIT_REMOTE_TESTGIT_FAILURE="non-fast forward" \
265+
test_must_fail env GIT_REMOTE_TESTGIT_FAILURE="non-fast forward" \
266266
git push origin update &&
267267
git rev-parse --verify testgit/origin/heads/update >actual &&
268268
test_cmp expect actual

transport-helper.c

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

507+
static void check_helper_status(struct helper_data *data)
508+
{
509+
int pid, status;
510+
511+
pid = waitpid(data->helper->pid, &status, WNOHANG);
512+
if (pid < 0)
513+
die("Could not retrieve status of remote helper '%s'",
514+
data->name);
515+
if (pid > 0 && WIFEXITED(status))
516+
die("Remote helper '%s' died with %d",
517+
data->name, WEXITSTATUS(status));
518+
}
519+
507520
static int fetch_with_import(struct transport *transport,
508521
int nr_heads, struct ref **to_fetch)
509522
{
@@ -540,6 +553,7 @@ static int fetch_with_import(struct transport *transport,
540553

541554
if (finish_command(&fastimport))
542555
die(_("error while running fast-import"));
556+
check_helper_status(data);
543557

544558
/*
545559
* The fast-import stream of a remote helper that advertises
@@ -1159,6 +1173,7 @@ static int push_refs_with_export(struct transport *transport,
11591173

11601174
if (finish_command(&exporter))
11611175
die(_("error while running fast-export"));
1176+
check_helper_status(data);
11621177
if (push_update_refs_status(data, remote_refs, flags))
11631178
return 1;
11641179

0 commit comments

Comments
 (0)