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

Re: [PATCH] Do not ignore hidden refs

From
Junio C Hamano <junkio@cox.net>
Date
Nov 18, 2006, 04:39 UTC
Message-ID
<7v8xi9fjw9.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<20061118041137.6064.75827.stgit@machine.or.cz>
Petr Baudis <pasky@suse.cz> writes:
> Some of the ref manipulation tools (git-for-each-ref and git-show-ref in
> particular) would not handle hidden (~ /^\./) refs.

refs.c::check_ref_format() seems to suggest that any ref whose path component begins with a dot is invalid (since October last year), so I am a bit surprised you are bringing this up now. Do you know of specific examples where this is not enforced? It could even be argued that the places in the system that allow such a ref are buggy.

I do not recall why we decided that this particular restriction was needed (I do understand the other three restrictions --- see commit log of 03feddd6), although I do think this is not a gratuitous change but comes from a list discussion. I suspect it was to avoid confusion with ".." operator ("..." was added much later in July this year), but it is not consistent that we do not forbid the ones that end with a dot.

Maybe we should have found this inconsistency and added "names that end with a dot" to the forbidden category when we introduced the symmetric difference, but apparently nobody noticed. Right now foo...bar is seriously ambiguous. Even though it cannot be "foo" .. ".bar" (because ".bar" is not a valid refname), it can be "foo." .. "bar" or "foo" ... "bar", and worse yet spelling longhand form "refs/heads/foo." does not help to disambiguate this.

Previous: Petr BaudisNext: Petr Baudis
Message 2 of 14 in “Do not ignore hidden refs”
  1. Do not ignore hidden refsPetr Baudis, Nov 18, 2006
  2. Junio C HamanoNov 18, 2006
  3. Petr BaudisNov 18, 2006
  4. Junio C HamanoNov 18, 2006
  5. Shawn PearceNov 18, 2006
  6. Petr BaudisNov 18, 2006
  7. Junio C HamanoNov 18, 2006
  8. Petr BaudisNov 18, 2006
  9. Junio C HamanoNov 18, 2006
  10. Petr BaudisNov 18, 2006
  11. Junio C HamanoNov 19, 2006
  12. Petr BaudisNov 19, 2006
  13. Linus TorvaldsNov 18, 2006
  14. Junio C HamanoNov 18, 2006

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.