git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: check-ref-format question

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
May 14, 2009, 07:24 UTC
Message-ID
<4A0BC717.1060900@drmicha.warpmail.net>
In-Reply-To
<93c3eada0905131726p3afe8e68j160bd3931886093d@mail.gmail.com>
Geoff Russell venit, vidit, dixit 14.05.2009 02:26:
Show 46 quoted lines
> On Wed, May 13, 2009 at 11:43 PM, Michael J Gruber
> <git@drmicha.warpmail.net> wrote:
>> Geoff Russell venit, vidit, dixit 13.05.2009 02:09:
>>> 1 $ git --version
>>> git version 1.6.2.3
>>> 2 $ git check-ref-format xxxx && echo OK
>>> 3 $ git-check-ref-format --branch xxxx && echo OK
>>> xxxx
>>> OK
>>> 4 $ git check-ref-format --branch xxxx && echo OK
>>> usage: git check-ref-format refname
>>>
>>>
>>> 2 seems wrong,
>>> I tried 3 after looking at  builtin-check-ref-format.c
>>> I couldn't find any test cases in the git/t directory
>>>
>>> From the documenation, I expect "git check-ref-format xxx" to return 0 if xxx is
>>> a valid branch or ref name.  git version 1.6.3 gives the same results.
>>
>> There are several things going on:
>>
>> A) In 3 you use a different git than in 1,2,4. You told us the latter is
>> 1.6.2.3, and I'm telling you the former contains v1.6.2.1-310-ga31dca0
>> (which has the new --branch option).
>> This simply checks whether refs/heads/xxxx is sane. (It also resolves
>> @{-1} and such, which is what makes it useful at all.)
> 
> Sorry, my mistake I was running in 2 windows on 2 machine and got
> confused. Ignore
> line 3 in my example.
> 
>>
>> B) "master" certainly looks like a valid refname, the doc seems to imply
>> that it should pass the check.
> 
> $ git --version
> git version 1.6.2.3
> $ git check-ref-format xxxx && echo OK
> $ git check-ref-format master && echo OK
> $ git check-ref-format master/xxxx && echo OK
> OK
> 
> I'm confused.
> 
> Geoff.

Please read on to my item C), and check the documentation patch which I submitted. If you're still confused after that I need to revise my patch ;)

Show 12 quoted lines
> 
> 
>>
>> C) Looking at the code, check-ref-format checks explicitly for the
>> presence of at least 2 levels: foo/bar is good, foo is bad. So, master
>> always had been bad, as well (or bad) as full sha1s!
>>
>> The code has always behaved like C since its inception but I don't know
>> the rationale behind the 2 level requirement. Daniel, Junio?
>>
>> Michael
>>
Previous: Geoff Russell
Message 8 of 8 in “check-ref-format question”
  1. Geoff RussellMay 13, 2009
  2. Michael J GruberMay 13, 2009
  3. Sverre RabbelierMay 13, 2009
  4. Daniel BarkalowMay 13, 2009
  5. Documentation: clarify / requirement in 'git check-ref-format'Michael J Gruber, May 13, 2009
  6. Geoff RussellMay 18, 2009
  7. Geoff RussellMay 14, 2009
  8. Michael J GruberMay 14, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.