aboutsummaryrefslogtreecommitdiff
path: root/refs.h
diff options
context:
space:
mode:
authorRonnie Sahlberg <sahlberg@google.com>2014-06-20 07:42:51 -0700
committerJunio C Hamano <gitster@pobox.com>2014-07-14 11:54:41 -0700
commit835e3c992fd453d172466be29283b55a792cac76 (patch)
treedf0f27afd2571eff1ad12591d000834f80c333eb /refs.h
parentbd3b02daec241651231f63b3fd8ee2a8ea1dac68 (diff)
downloadgit-835e3c992fd453d172466be29283b55a792cac76.tar.gz
git-835e3c992fd453d172466be29283b55a792cac76.tar.xz
refs.c: verify_lock should set errno to something meaningful
Making errno when returning from verify_lock() meaningful, which should almost but not completely fix * a bug in "git fetch"'s s_update_ref, which trusts the result of an errno == ENOTDIR check to detect D/F conflicts ENOTDIR makes sense as a sign that a file was in the way of a directory we wanted to create. Should "git fetch" also look for ENOTEMPTY or EEXIST to catch cases where a directory was in the way of a file to be created? Signed-off-by: Ronnie Sahlberg <sahlberg@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com> Acked-by: Michael Haggerty <mhagger@alum.mit.edu>
Diffstat (limited to 'refs.h')
-rw-r--r--refs.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/refs.h b/refs.h
index 82cc5cb2a..8d6cac717 100644
--- a/refs.h
+++ b/refs.h
@@ -137,11 +137,15 @@ extern int ref_exists(const char *);
*/
extern int peel_ref(const char *refname, unsigned char *sha1);
-/** Locks a "refs/" ref returning the lock on success and NULL on failure. **/
+/*
+ * Locks a "refs/" ref returning the lock on success and NULL on failure.
+ * On failure errno is set to something meaningful.
+ */
extern struct ref_lock *lock_ref_sha1(const char *refname, const unsigned char *old_sha1);
/** Locks any ref (for 'HEAD' type refs). */
#define REF_NODEREF 0x01
+/* errno is set to something meaningful on failure */
extern struct ref_lock *lock_any_ref_for_update(const char *refname,
const unsigned char *old_sha1,
int flags, int *type_p);