Re: [PATCH] check-ref-format: require a repository for --branch
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 17, 2017, 01:22 UTC
- Message-ID
- <xmqqbml6r2js.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <20171016224512.6fhtce5anmff577b@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 18 quoted lines
> On Mon, Oct 16, 2017 at 07:45:46PM +0900, Junio C Hamano wrote:
>
>> > So I think the right endgame in the longer term is:
>> > ...
>>
>> Here is to illustrate what I mean in a patch form. It resurrects
>> the gentle setup, and uses a purely textual format check when we are
>> outside the repository, while bypassing the @{magic} interpolation
>> codepath that requires us to be in a repository. When we are in a
>> repository, we operate the same way as before.
>
> I like the state this puts us in, but there's one catch: we're
> completely changing the meaning of "check-ref-format --branch", aren't
> we?
>
> It is going from "this is how you resolve @{-1}" to "this is how you
> check the validity of a potential branch name". Do we need to pick a
> different name, and/or have a deprecation period?That was not my intention. When used in a repository, it behaves exactly the same as before, including @{-1} resolution part. And by using strbuf_check_branch_ref(), it has always been checking the validity of a potential branch name, even though it wasn't advertised as such. The documentation needs to be updated, I would think.
When used outside a repository, @{-1} would not have worked anyway, and @{-1} continues not to work, but the part that checks the validity should continue to work.
At least that is what I wanted to happen in the patch.