On Mon, 19 Mar 2007, Junio C Hamano wrote:
Julian Phillips <julian@xxxxxxxxxxxxxxxxx> 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").
Um .. yes ... as per the comment in refs.c ... :$
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
The thing is, that wasn't what I expected. From looking at the code for
symbolic-ref I was expecting:
$ git symbolic-ref no-such; echo $?
fatal: No such ref: no-such
128
In particular, in quiet mode you will get a return of 1 - rather than
128, which would potentially lead you astray if you belived the man page
...
--
Julian
---
"Intelligence without character is a dangerous thing."
-- G. Steinem
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html