Re: [PATCH 1/2] fetch/push: allow refs/*:refs/*

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Michael Haggerty <mhagger@xxxxxxxxxxxx> writes:

>> diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c
>> index 6207ecd..a3e3fa3 100644
>> --- a/builtin/fetch-pack.c
>> +++ b/builtin/fetch-pack.c
>> @@ -546,7 +546,7 @@ static void filter_refs(struct ref **refs, int nr_match, char **match)
>>  	for (ref = *refs; ref; ref = next) {
>>  		next = ref->next;
>>  		if (!memcmp(ref->name, "refs/", 5) &&
>> -		    check_refname_format(ref->name + 5, 0))
>> +		    check_refname_format(ref->name, 0))
>>  			; /* trash */
>>  		else if (args.fetch_all &&
>>  			 (!args.depth || prefixcmp(ref->name, "refs/tags/") )) {
>
> I understand that you didn't introduce this code, but it seems like a
> suspicious combination of conditions:
>
>     if ((ref->name starts with "refs/")
>         and (ref->name has invalid format))

This protects us from getting contaminated by bogus ref under refs/
when running "fetch refs/heads/*:refs/remotes/origin/*" no?

The remote side can also throw phony "I have this object, too, but
not at a particular ref---this entry is only to let you know I have
it, so that we can negotiate minimal transfer better" entries that
are labelled with strings that do not begin with "refs/" and do not
pass check_refname_format() (and because they are not refs, they do
not have to pass the test) at us, and we do not want to filter them
out in this function.  But we do not want anything that is malformed
under "refs/".



--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]