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

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

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Oct 27, 2005, 17:40 UTC
Message-ID
<Pine.LNX.4.63.0510271936520.7518@wbgn013.biozentrum.uni-wuerzburg.de>

for_each_ref() used to ignore refs which point nowhere. Making git-fsck-objects be happy about them.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
	Of course, it may be by design. But then, it does not feel 
	right to me. If this is intended behaviour, please don't let me 
	die dumb.
 refs.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

applies-to: d29f6558d14b1da55642659c9874d4f52dac18bf 047627834b0ecb7ec0e0a98066b4b28688c374bc

diff --git a/refs.c b/refs.c
index a52b038..d74ede9 100644
--- a/refs.c
+++ b/refs.c
@@ -194,9 +194,9 @@ static int do_for_each_ref(const char *b
 				continue;
 			}
 			if (read_ref(git_path("%s", path), sha1) < 0)
-				continue;
+				die("%s points nowhere!", path);
 			if (!has_sha1_file(sha1))
-				continue;
+				die("%s does not point to a valid commit object!", path);
 			retval = fn(path, sha1);
 			if (retval)
 				break;
---
0.99.8.GIT
Next: Junio C Hamano
Message 1 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.