Skip to content

Commit d0dea2b

Browse files
SRabbelierdscho
authored andcommitted
remote-helper: check helper status after import/export
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com>
1 parent 479f8b6 commit d0dea2b

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

t/t5801-remote-helpers.sh

+1-1
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

+15
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,19 @@ static int get_exporter(struct transport *transport,
505505
return start_command(fastexport);
506506
}
507507

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

542555
if (finish_command(&fastimport))
543556
die(_("error while running fast-import"));
557+
check_helper_status(data);
544558

545559
/*
546560
* The fast-import stream of a remote helper that advertises
@@ -1160,6 +1174,7 @@ static int push_refs_with_export(struct transport *transport,
11601174

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

0 commit comments

Comments
 (0)