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

Re: [TENTATIVE PATCH] Complain loudly, dying, when a ref is invalid

From
Junio C Hamano <junkio@cox.net>
Date
Oct 27, 2005, 19:01 UTC
Message-ID
<7vacgu3hta.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<Pine.LNX.4.63.0510271936520.7518@wbgn013.biozentrum.uni-wuerzburg.de>

The only case that I can think of that this patch may make a difference in behaviour in a valid repository is the HEAD pointer that points at nowhere (i.e. refs/heads/master) immediately after git-init-db, so in that sense this change may be safe for most purposes.

However, we might want to write a tool to iterate over what we have under .git/refs/ and warn about them to help the user fix broken branches/tags, and do_for_each_ref() dying like this would not help that usage.

Not that the current loop is any better for that purpose. We silently ignore not just dangling ref and ref not storing 40-byte hex, but files starting with a period '.', names longer than 255 bytes, and unreadable ones, all of which we would probably want to warn about in such a tool.

-jc
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 2 of 5 in “Complain loudly, dying, when a ref is invalid”
  1. Complain loudly, dying, when a ref is invalidJohannes Schindelin, Oct 27, 2005
  2. Junio C HamanoOct 27, 2005
  3. Johannes SchindelinOct 27, 2005
  4. Junio C HamanoOct 27, 2005
  5. Warn about invalid refsJohannes Schindelin, Feb 28, 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.