]> git.ipfire.org Git - thirdparty/git.git/commit - refs.c
resolve_ref(): report breakage to the caller without warning
authorJunio C Hamano <gitster@pobox.com>
Wed, 19 Oct 2011 20:55:49 +0000 (13:55 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 19 Oct 2011 20:58:15 +0000 (13:58 -0700)
commit55956350024f0706294001cb50d513cf0fa038a1
tree69734f107e5d2aa719e8c8c1ef4a623b77658519
parent98ac34b2b1968e16fbf7f6122a53b73c6caaff49
resolve_ref(): report breakage to the caller without warning

629cd3a (resolve_ref(): emit warnings for improperly-formatted references,
2011-09-15) made resolve_ref() warn against files that are found in the
directories the ref dwimmery looks at. The intent may be good, but these
messages come from a wrong level of the API hierarchy.

Instead record the breakage in "flags" whose purpose is to explain the
result of the function to the caller, who is in a much better position to
make intelligent decision based on the information.

This updates sha1_name.c::dwim_ref() to warn against such a broken
candidate only when it does not appear directly below $GIT_DIR to restore
the traditional behaviour, as we know many files directly underneath
$GIT_DIR/ are not refs.

Warning against "git show config --" with "$GIT_DIR/config does not look
like a well-formed ref" does not make sense, and we may later tweak the
dwimmery not to even consider them as candidates, but that is a longer
term topic.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
refs.c