summaryrefslogtreecommitdiff
path: root/builtin-fetch.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin-fetch.c')
-rw-r--r--builtin-fetch.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/builtin-fetch.c b/builtin-fetch.c
index e4486e4286..e56617e32e 100644
--- a/builtin-fetch.c
+++ b/builtin-fetch.c
@@ -575,8 +575,6 @@ static int do_fetch(struct transport *transport,
free_refs(ref_map);
}
- transport_disconnect(transport);
-
return 0;
}
@@ -597,6 +595,7 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
int i;
static const char **refs = NULL;
int ref_nr = 0;
+ int exit_code;
/* Record the command line for the reflog */
strbuf_addstr(&default_rla, "fetch");
@@ -650,6 +649,9 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
signal(SIGINT, unlock_pack_on_signal);
atexit(unlock_pack);
- return do_fetch(transport,
+ exit_code = do_fetch(transport,
parse_fetch_refspec(ref_nr, refs), ref_nr);
+ transport_disconnect(transport);
+ transport = NULL;
+ return exit_code;
}