Re: [PATCH] fetch/push: allow refs/*:refs/*
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 7, 2012, 16:24 UTC
- Message-ID
- <7vobq06jt7.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <4FA4C2CC.7080205@alum.mit.edu>
Michael Haggerty <mhagger@alum.mit.edu> writes:
> This combination "!memcmp(ref->name, "refs/", 5) && > check_refname_format(ref->name, 0)" is the reason that I suggested > adding a REFNAME_FULL option [1], in which case it could be written > "check_refname_format(ref->name, REFNAME_FULL)".
I personally think that check-refname-format should lose its second parameter and always check for a concrete full refs, so that we can tighten the current allow-onelevel case a bit further (i.e. ".git/HEAD" is OK at the root level, but ".git/refs/heads/HEAD" is asking for trouble, and ".git/config" is downright confusing. The function does not get a good enough clue by only ONELEVEL). That would mean REFNAME_FULL will not be necessary---it should be the only mode of operation, and the callers need to be adjusted accordingly.
We should also introduce another function check-refspec-half-format to be used for the checks for left and right halves of refspec ("refs/heads/*" is OK but "refs/heads*" is not, perhaps).
A single function trying to do both and not doing a good job in either case is not a pretty picture.