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

[PATCH] git-symbolic-ref: fix error message when ref doesn't exist

From
Julian Phillips <julian@quantumfyre.co.uk>
Date
Mar 18, 2007, 01:53 UTC
Message-ID
<20070318020645.2444.75365.julian@quantumfyre.co.uk>

When calling resolve_ref from check_symref set reading to 1, since we do want to know if the given ref doesn't exist. This means that "git symbolic-ref foo" will now print "fatal: No such ref: foo" as expected.

Signed-off-by: Julian Phillips <julian@quantumfyre.co.uk>
---

While looking at how fetch worked, I noticed that symbolic-ref was supposed to differentiate between non-existent refs and non-symbolic refs. Something I hadn't noticed it doing on those occasions when my fingers had failed me ...

I also noticed that the man page says that symbolic-ref will return 1 when the specified reference is non-symbolic. This is only true when using -q, but I don't know if the code or man page wants changing ...

 builtin-symbolic-ref.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/builtin-symbolic-ref.c b/builtin-symbolic-ref.c
index d41b406..a93c85d 100644
--- a/builtin-symbolic-ref.c
+++ b/builtin-symbolic-ref.c
@@ -9,7 +9,7 @@ static void check_symref(const char *HEAD, int quiet)
 {
 	unsigned char sha1[20];
 	int flag;
-	const char *refs_heads_master = resolve_ref(HEAD, sha1, 0, &flag);
+	const char *refs_heads_master = resolve_ref(HEAD, sha1, 1, &flag);
 
 	if (!refs_heads_master)
 		die("No such ref: %s", HEAD);
-- 
1.5.0.4
Next: Junio C Hamano
Message 1 of 3 in “git-symbolic-ref: fix error message when ref doesn't exist”
  1. git-symbolic-ref: fix error message when ref doesn't existJulian Phillips, Mar 18, 2007
  2. Junio C HamanoMar 19, 2007
  3. Julian PhillipsMar 19, 2007

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.