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

Reference name and check-ref-format

From
RGRomain Geissler <romain.geissler@gmail.com>
Date
Jun 8, 2011, 12:50 UTC
Message-ID
<67B97116-1D1A-417B-87F2-6E24260E3BFF@gmail.com>
Hello,
While writing a git client based on libgit2 (https://github.com/Romain-Geissler/git2), i have to rewrite git-check-ref-format. The man documentation about that command is clear enough, and there is no issue to implement it. Seven from the eight naming rules described in this man make sens to me, but i can't understand why is there a need for the second one:
 2. They must contain at least one /. This enforces the presence of a category like heads/, tags/ etc. but the actual names are not restricted.
The implementation respects that rule, and thus git check-ref-format HEAD will return 1. But why does a reference name must have a slash ? HEAD, FETCH_HEAD and others are references, but do not contain any slash. And this do not prevent us to use such refs anywhere in git. That even works with "non-magic" git reference, if we create by ourself a reference file in the root of our $GIT_DIR, and can be use as a reference name in any git command except with git-check-ref-format.
I am utterly wrong or is there difference between what's specified in git-check-ref-format and what git really does ?
Romain Geissler
Message 1 of 1 in “Reference name and check-ref-format”
  1. Romain GeisslerJun 8, 2011

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.