diff options
author | Junio C Hamano <gitster@pobox.com> | 2015-03-25 12:54:25 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-03-25 12:54:25 -0700 |
commit | 2f6ef7138790d80c43024b132b15ad06daacf266 (patch) | |
tree | 3f7c9b2099a4c12051c4c94b6b36587b39433dab /fetch-pack.c | |
parent | 927936d75391a81250543c928fed620a2af98464 (diff) | |
parent | 32d0462f8da9cc4e26ca1e785098e2ae1bee4d02 (diff) | |
download | git-2f6ef7138790d80c43024b132b15ad06daacf266.tar.gz |
Merge branch 'jk/fetch-pack'
"git fetch" that fetches a commit using the allow-tip-sha1-in-want
extension could have failed to fetch all the requested refs.
* jk/fetch-pack:
fetch-pack: remove dead assignment to ref->new_sha1
fetch_refs_via_pack: free extra copy of refs
filter_ref: make a copy of extra "sought" entries
filter_ref: avoid overwriting ref->old_sha1 with garbage
Diffstat (limited to 'fetch-pack.c')
-rw-r--r-- | fetch-pack.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/fetch-pack.c b/fetch-pack.c index 655ee64256..48526aa54b 100644 --- a/fetch-pack.c +++ b/fetch-pack.c @@ -544,16 +544,19 @@ static void filter_refs(struct fetch_pack_args *args, /* Append unmatched requests to the list */ if (allow_tip_sha1_in_want) { for (i = 0; i < nr_sought; i++) { + unsigned char sha1[20]; + ref = sought[i]; if (ref->matched) continue; - if (get_sha1_hex(ref->name, ref->old_sha1)) + if (get_sha1_hex(ref->name, sha1) || + ref->name[40] != '\0' || + hashcmp(sha1, ref->old_sha1)) continue; ref->matched = 1; - *newtail = ref; - ref->next = NULL; - newtail = &ref->next; + *newtail = copy_ref(ref); + newtail = &(*newtail)->next; } } *refs = newlist; @@ -625,7 +628,6 @@ static int everything_local(struct fetch_pack_args *args, for (retval = 1, ref = *refs; ref ; ref = ref->next) { const unsigned char *remote = ref->old_sha1; - unsigned char local[20]; struct object *o; o = lookup_object(remote); @@ -638,8 +640,6 @@ static int everything_local(struct fetch_pack_args *args, ref->name); continue; } - - hashcpy(ref->new_sha1, local); if (!args->verbose) continue; fprintf(stderr, |