Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
do_fetch(): clean up existing_refs before exiting
author
Michael Haggerty
<mhagger@alum.mit.edu>
Sat, 25 May 2013 09:08:16 +0000
(11:08 +0200)
committer
Junio C Hamano
<gitster@pobox.com>
Sun, 2 Jun 2013 22:28:47 +0000
(15:28 -0700)
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/fetch.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
6f64a16
)
diff --git
a/builtin/fetch.c
b/builtin/fetch.c
index 80c6e37d27a89f587dea72a4a243404b78cbdf45..48df5fa4800431969ae8d237e9a7fac95ae0c169 100644
(file)
--- a/
builtin/fetch.c
+++ b/
builtin/fetch.c
@@
-697,6
+697,7
@@
static int do_fetch(struct transport *transport,
struct ref *ref_map;
struct ref *rm;
int autotags = (transport->remote->fetch_tags == 1);
struct ref *ref_map;
struct ref *rm;
int autotags = (transport->remote->fetch_tags == 1);
+ int retcode = 0;
for_each_ref(add_existing, &existing_refs);
for_each_ref(add_existing, &existing_refs);
@@
-712,9
+713,9
@@
static int do_fetch(struct transport *transport,
/* if not appending, truncate FETCH_HEAD */
if (!append && !dry_run) {
/* if not appending, truncate FETCH_HEAD */
if (!append && !dry_run) {
-
int err
code = truncate_fetch_head();
- if (
err
code)
-
return errcode
;
+
ret
code = truncate_fetch_head();
+ if (
ret
code)
+
goto cleanup
;
}
ref_map = get_ref_map(transport, refs, ref_count, tags, &autotags);
}
ref_map = get_ref_map(transport, refs, ref_count, tags, &autotags);
@@
-736,7
+737,8
@@
static int do_fetch(struct transport *transport,
transport_set_option(transport, TRANS_OPT_FOLLOWTAGS, "1");
if (fetch_refs(transport, ref_map)) {
free_refs(ref_map);
transport_set_option(transport, TRANS_OPT_FOLLOWTAGS, "1");
if (fetch_refs(transport, ref_map)) {
free_refs(ref_map);
- return 1;
+ retcode = 1;
+ goto cleanup;
}
if (prune) {
/* If --tags was specified, pretend the user gave us the canonical tags refspec */
}
if (prune) {
/* If --tags was specified, pretend the user gave us the canonical tags refspec */
@@
-779,7
+781,9
@@
static int do_fetch(struct transport *transport,
free_refs(ref_map);
}
free_refs(ref_map);
}
- return 0;
+ cleanup:
+ string_list_clear(&existing_refs, 0);
+ return retcode;
}
static void set_option(const char *name, const char *value)
}
static void set_option(const char *name, const char *value)