refs.c: propagate any errno==ENOTDIR from _commit back to the callers
commitd0160fc36af836a2fd77d2a81a4901272072c099
authorRonnie Sahlberg <sahlberg@google.com>
Wed, 16 Jul 2014 22:23:09 +0000 (16 15:23 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 17 Jul 2014 20:01:04 +0000 (17 13:01 -0700)
tree4677510c23b17c2374ae6041ec488615f5166450
parent23acf975d74825789112a3a7ba97dbbdc76904f4
refs.c: propagate any errno==ENOTDIR from _commit back to the callers

In _commit, ENOTDIR can happen in the call to lock_ref_sha1_basic, either when
we lstat the new refname and it returns ENOTDIR or if the name checking
function reports that the same type of conflict happened. In both cases it
means that we can not create the new ref due to a name conflict.

For these cases, save the errno value and abort and make sure that the caller
can see errno==ENOTDIR.

Also start defining specific return codes for _commit, assign -1 as a generic
error and -2 as the error that refers to a name conflict. Callers can (and
should) use that return value inspecting errno directly.

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
refs.c
refs.h