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

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

From
Junio C Hamano <junkio@cox.net>
Date
Mar 19, 2007, 08:47 UTC
Message-ID
<7vslc1iprn.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<20070318020645.2444.75365.julian@quantumfyre.co.uk>
Julian Phillips <julian@quantumfyre.co.uk> writes:
> 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.
Hmmmm.  That would break:
	$ rm -fr a; mkdir a; cd a
	$ git init-db
        $ git symbolic-ref HEAD
        refs/heads/master

wouldn't it? We do want it not to fail and tell us that the commit we are going to create will be on refs/heads/master (i.e. "the master branch").

And the command errors out as expected when given a non-existent symbolic ref:

	$ git symbolic-ref no-such; echo $?
	fatal: ref no-such is not a symbolic ref
	128
Previous: Julian PhillipsNext: Julian Phillips
Message 2 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.