Code

Display an error from update-ref if target ref name is invalid.
authorShawn Pearce <spearce@spearce.org>
Sat, 29 Jul 2006 03:44:51 +0000 (23:44 -0400)
committerJunio C Hamano <junkio@cox.net>
Sat, 29 Jul 2006 03:53:53 +0000 (20:53 -0700)
commit818f477c40fee62ab8ea5b493c51bb357f38957c
tree5e03cb93f7518b99b86a9c66246f0e14952266c5
parent1b03dfed182a1dc47cc0eb1047a34cd914440ce6
Display an error from update-ref if target ref name is invalid.

Alex Riesen (raa.lkml@gmail.com) recently observed that git branch
would fail with no error message due to unexpected situations with
regards to refs.  For example, if .git/refs/heads/gu is a file but
"git branch -b refs/heads/gu/fixa HEAD" was invoked by the user
it would fail silently due to refs/heads/gu being a file and not
a directory.

This change adds a test for trying to create a ref within a directory
that is actually currently a file, and adds error printing within
the ref locking routine should the resolve operation fail.

The error printing code probably belongs at this level of the library
as other failures within the ref locking, writing and logging code
are also currently at this level of the code.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
refs.c
t/t1400-update-ref.sh