Permalink
Browse files

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>
  • Loading branch information...
1 parent debbbfe commit d36a13db2b3083f8f3c58bd3075ff4ce4cfff5ed @SRabbelier SRabbelier committed with dscho Jul 23, 2011
Showing with 19 additions and 1 deletion.
  1. +3 −1 builtin/clone.c
  2. +16 −0 transport-helper.c
View
4 builtin/clone.c
@@ -821,7 +821,9 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
}
if (!is_local && !complete_refs_before_fetch)
- transport_fetch_refs(transport, mapped_refs);
+ if (transport_fetch_refs(transport, mapped_refs))
+ die(_("could not fetch refs from %s"),
+ transport->url);
remote_head = find_ref_by_name(refs, "HEAD");
remote_head_points_at =
View
16 transport-helper.c
@@ -415,6 +415,19 @@ static int get_exporter(struct transport *transport,
return start_command(fastexport);
}
+static void check_helper_status(struct helper_data *data)
+{
+ int pid, status;
+
+ pid = waitpid(data->helper->pid, &status, WNOHANG);
+ if (pid < 0)
+ die("Could not retrieve status of remote helper '%s'",
+ data->name);
+ if (pid > 0 && WIFEXITED(status))
+ die("Remote helper '%s' died with %d",
+ data->name, WEXITSTATUS(status));
+}
+
static int fetch_with_import(struct transport *transport,
int nr_heads, struct ref **to_fetch)
{
@@ -443,6 +456,8 @@ static int fetch_with_import(struct transport *transport,
if (finish_command(&fastimport))
die("Error while running fast-import");
+ check_helper_status(data);
+
free(fastimport.argv);
fastimport.argv = NULL;
@@ -771,6 +786,7 @@ static int push_refs_with_export(struct transport *transport,
if (finish_command(&exporter))
die("Error while running fast-export");
+ check_helper_status(data);
push_update_refs_status(data, remote_refs);
return 0;
}

0 comments on commit d36a13d

Please sign in to comment.