Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit 83ddf68

Browse files
SRabbelierkblees
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 c9d910d commit 83ddf68

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

builtin/clone.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -947,7 +947,9 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
947947
}
948948

949949
if (!is_local && !complete_refs_before_fetch)
950-
transport_fetch_refs(transport, mapped_refs);
950+
if (transport_fetch_refs(transport, mapped_refs))
951+
die(_("could not fetch refs from %s"),
952+
transport->url);
951953

952954
remote_head = find_ref_by_name(refs, "HEAD");
953955
remote_head_points_at =

transport-helper.c

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

444+
static void check_helper_status(struct helper_data *data)
445+
{
446+
int pid, status;
447+
448+
pid = waitpid(data->helper->pid, &status, WNOHANG);
449+
if (pid < 0)
450+
die("Could not retrieve status of remote helper '%s'",
451+
data->name);
452+
if (pid > 0 && WIFEXITED(status))
453+
die("Remote helper '%s' died with %d",
454+
data->name, WEXITSTATUS(status));
455+
}
456+
444457
static int fetch_with_import(struct transport *transport,
445458
int nr_heads, struct ref **to_fetch)
446459
{
@@ -476,6 +489,7 @@ static int fetch_with_import(struct transport *transport,
476489

477490
if (finish_command(&fastimport))
478491
die("Error while running fast-import");
492+
check_helper_status(data);
479493

480494
/*
481495
* The fast-import stream of a remote helper that advertises
@@ -915,6 +929,7 @@ static int push_refs_with_export(struct transport *transport,
915929

916930
if (finish_command(&exporter))
917931
die("Error while running fast-export");
932+
check_helper_status(data);
918933
if (push_update_refs_status(data, remote_refs, flags))
919934
return 1;
920935

0 commit comments

Comments
 (0)