summaryrefslogtreecommitdiff
path: root/fetch-pack.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-04-25 07:41:23 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-04-25 07:41:23 (GMT)
commit57a6b93236f3b1667a1947d3fc83f6e942d3bfca (patch)
tree691ff68a01bebe594b7dba3e8c1eba86f4e85a82 /fetch-pack.c
parent449f2db75dd990d5b1157c7d4da49f046eab27c6 (diff)
parent34066f06614d6dbc1955c92ba0c3a17dbfeb0077 (diff)
downloadgit-57a6b93236f3b1667a1947d3fc83f6e942d3bfca.zip
git-57a6b93236f3b1667a1947d3fc83f6e942d3bfca.tar.gz
git-57a6b93236f3b1667a1947d3fc83f6e942d3bfca.tar.bz2
Merge branch 'jk/fetch-reachability-error-fix'
Code clean-up and a fix for "git fetch" by an explicit object name (as opposed to fetching refs by name). * jk/fetch-reachability-error-fix: fetch: do not consider peeled tags as advertised tips remote.c: make singular free_ref() public fetch: use free_refs() pkt-line: prepare buffer before handling ERR packets upload-pack: send ERR packet for non-tip objects t5530: check protocol response for "not our ref" t5516: drop ok=sigpipe from unreachable-want tests
Diffstat (limited to 'fetch-pack.c')
-rw-r--r--fetch-pack.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/fetch-pack.c b/fetch-pack.c
index 0f15877..3f24d0c 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -573,9 +573,14 @@ static void filter_refs(struct fetch_pack_args *args,
next = ref->next;
if (starts_with(ref->name, "refs/") &&
- check_refname_format(ref->name, 0))
- ; /* trash */
- else {
+ check_refname_format(ref->name, 0)) {
+ /*
+ * trash or a peeled value; do not even add it to
+ * unmatched list
+ */
+ free_one_ref(ref);
+ continue;
+ } else {
while (i < nr_sought) {
int cmp = strcmp(ref->name, sought[i]->name);
if (cmp < 0)
@@ -630,10 +635,7 @@ static void filter_refs(struct fetch_pack_args *args,
}
oidset_clear(&tip_oids);
- for (ref = unmatched; ref; ref = next) {
- next = ref->next;
- free(ref);
- }
+ free_refs(unmatched);
*refs = newlist;
}