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

Commit e32da27

Browse files
SRabbelierkasal
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 df8dfa3 commit e32da27

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
@@ -943,7 +943,9 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
943943
}
944944

945945
if (!is_local && !complete_refs_before_fetch)
946-
transport_fetch_refs(transport, mapped_refs);
946+
if (transport_fetch_refs(transport, mapped_refs))
947+
die(_("could not fetch refs from %s"),
948+
transport->url);
947949

948950
remote_head = find_ref_by_name(refs, "HEAD");
949951
remote_head_points_at =

transport-helper.c

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

455+
static void check_helper_status(struct helper_data *data)
456+
{
457+
int pid, status;
458+
459+
pid = waitpid(data->helper->pid, &status, WNOHANG);
460+
if (pid < 0)
461+
die("Could not retrieve status of remote helper '%s'",
462+
data->name);
463+
if (pid > 0 && WIFEXITED(status))
464+
die("Remote helper '%s' died with %d",
465+
data->name, WEXITSTATUS(status));
466+
}
467+
455468
static int fetch_with_import(struct transport *transport,
456469
int nr_heads, struct ref **to_fetch)
457470
{
@@ -488,6 +501,7 @@ static int fetch_with_import(struct transport *transport,
488501
if (finish_command(&fastimport))
489502
die("Error while running fast-import");
490503
argv_array_free_detached(fastimport.argv);
504+
check_helper_status(data);
491505

492506
/*
493507
* The fast-import stream of a remote helper that advertises
@@ -913,6 +927,7 @@ static int push_refs_with_export(struct transport *transport,
913927

914928
if (finish_command(&exporter))
915929
die("Error while running fast-export");
930+
check_helper_status(data);
916931
if (push_update_refs_status(data, remote_refs, flags))
917932
return 1;
918933

0 commit comments

Comments
 (0)