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

Commit 23d01f5

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 54beb02 commit 23d01f5

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
@@ -454,6 +454,19 @@ static int get_exporter(struct transport *transport,
454454
return start_command(fastexport);
455455
}
456456

457+
static void check_helper_status(struct helper_data *data)
458+
{
459+
int pid, status;
460+
461+
pid = waitpid(data->helper->pid, &status, WNOHANG);
462+
if (pid < 0)
463+
die("Could not retrieve status of remote helper '%s'",
464+
data->name);
465+
if (pid > 0 && WIFEXITED(status))
466+
die("Remote helper '%s' died with %d",
467+
data->name, WEXITSTATUS(status));
468+
}
469+
457470
static int fetch_with_import(struct transport *transport,
458471
int nr_heads, struct ref **to_fetch)
459472
{
@@ -490,6 +503,7 @@ static int fetch_with_import(struct transport *transport,
490503
if (finish_command(&fastimport))
491504
die("Error while running fast-import");
492505
argv_array_free_detached(fastimport.argv);
506+
check_helper_status(data);
493507

494508
/*
495509
* The fast-import stream of a remote helper that advertises
@@ -898,6 +912,7 @@ static int push_refs_with_export(struct transport *transport,
898912

899913
if (finish_command(&exporter))
900914
die("Error while running fast-export");
915+
check_helper_status(data);
901916
push_update_refs_status(data, remote_refs);
902917
return 0;
903918
}

0 commit comments

Comments
 (0)