summaryrefslogtreecommitdiff
path: root/builtin/fetch.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-03-20 18:29:19 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-03-20 18:29:19 (GMT)
commit96203bb074544a37fcff9c3f2a68582b76caa263 (patch)
treec94d11799e9665230fc1bdf462fc6142590ce948 /builtin/fetch.c
parent6a01298a7ed2c18cd68358127304024575b27cc0 (diff)
parent8fe5d87622a4268079bf1e5738474f85d4e5c3bc (diff)
downloadgit-96203bb074544a37fcff9c3f2a68582b76caa263.zip
git-96203bb074544a37fcff9c3f2a68582b76caa263.tar.gz
git-96203bb074544a37fcff9c3f2a68582b76caa263.tar.bz2
Merge branch 'maint'
* maint: Update draft release notes to 1.7.0.3 fetch: Fix minor memory leak fetch: Future-proof initialization of a refspec on stack fetch: Check for a "^{}" suffix with suffixcmp() daemon: parse_host_and_port SIGSEGV if port is specified Makefile: Fix CDPATH problem pull: replace unnecessary sed invocation
Diffstat (limited to 'builtin/fetch.c')
-rw-r--r--builtin/fetch.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/builtin/fetch.c b/builtin/fetch.c
index 2bb75c1..957be9f 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -107,10 +107,8 @@ static void add_merge_config(struct ref **head,
* there is no entry in the resulting FETCH_HEAD marked
* for merging.
*/
+ memset(&refspec, 0, sizeof(refspec));
refspec.src = branch->merge[i]->src;
- refspec.dst = NULL;
- refspec.pattern = 0;
- refspec.force = 0;
get_fetch_map(remote_refs, &refspec, tail, 1);
for (rm = *old_tail; rm; rm = rm->next)
rm->merge = 1;
@@ -391,9 +389,10 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
fputc(url[i], fp);
fputc('\n', fp);
- if (ref)
+ if (ref) {
rc |= update_local_ref(ref, what, note);
- else
+ free(ref);
+ } else
sprintf(note, "* %-*s %-*s -> FETCH_HEAD",
TRANSPORT_SUMMARY_WIDTH, *kind ? kind : "branch",
REFCOL_WIDTH, *what ? what : "HEAD");
@@ -590,7 +589,7 @@ static void find_non_local_tags(struct transport *transport,
* to fetch then we can mark the ref entry in the list
* as one to ignore by setting util to NULL.
*/
- if (!strcmp(ref->name + strlen(ref->name) - 3, "^{}")) {
+ if (!suffixcmp(ref->name, "^{}")) {
if (item && !has_sha1_file(ref->old_sha1) &&
!will_fetch(head, ref->old_sha1) &&
!has_sha1_file(item->util) &&