From: Junio C Hamano Date: Mon, 19 Mar 2007 08:47:08 GMT Subject: Re: [PATCH] git-symbolic-ref: fix error message when ref doesn't exist Message-ID: <7vslc1iprn.fsf@assigned-by-dhcp.cox.net> In-Reply-To: <20070318020645.2444.75365.julian@quantumfyre.co.uk> Julian Phillips 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