summaryrefslogtreecommitdiff
path: root/refs.h
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2013-04-22 21:52:21 +0200
committerJunio C Hamano <gitster@pobox.com>2013-05-01 15:33:10 -0700
commit2312a7932080f17c2847ec3ce5dddbc65c2e0b41 (patch)
treea3fbe27bc6745af79eea92a4daea0b354153ccb7 /refs.h
parent68cf87034402500f0c5dfb8d618b98b4e09895a7 (diff)
downloadgit-2312a7932080f17c2847ec3ce5dddbc65c2e0b41.tar.gz
peel_ref(): fix return value for non-peelable, not-current reference
The old version was inconsistent: when a reference was REF_KNOWS_PEELED but with a null peeled value, it returned non-zero for the current reference but zero for other references. Change the behavior for non-current references to match that of current_ref, which is what callers expect. Document the behavior. Current callers only call peel_ref() from within a for_each_ref-style iteration and only for the current ref; therefore, the buggy code path was never reached. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs.h')
-rw-r--r--refs.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/refs.h b/refs.h
index f111024a18..3fc97a2e4a 100644
--- a/refs.h
+++ b/refs.h
@@ -74,6 +74,14 @@ extern void add_packed_ref(const char *refname, const unsigned char *sha1);
extern int ref_exists(const char *);
+/*
+ * If refname is a non-symbolic reference that refers to a tag object,
+ * and the tag can be (recursively) dereferenced to a non-tag object,
+ * store the SHA1 of the referred-to object to sha1 and return 0. If
+ * any of these conditions are not met, return a non-zero value.
+ * Symbolic references are considered unpeelable, even if they
+ * ultimately resolve to a peelable tag.
+ */
extern int peel_ref(const char *refname, unsigned char *sha1);
/** Locks a "refs/" ref returning the lock on success and NULL on failure. **/