summaryrefslogtreecommitdiff
path: root/refs.h
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-01-01 22:33:20 -0800
committerJunio C Hamano <gitster@pobox.com>2008-01-02 02:28:54 -0800
commit5f7b202a7fa8ffbf076c456106750b2bb7732ba4 (patch)
tree0acba82e3731e1fa1a28dda325d6b48a7da78dbb /refs.h
parent49b9362fd35d45dc94ea15006c4bb88671b8da7d (diff)
downloadgit-5f7b202a7fa8ffbf076c456106750b2bb7732ba4.tar.gz
lock_any_ref_for_update(): reject wildcard return from check_ref_format
Recent check_ref_format() returns -3 as well as -1 (general error) and -2 (less than two levels). The caller was explicitly checking for -1, to allow "HEAD" but still needed to disallow bogus refs. This introduces symbolic constants for the return values from check_ref_format() to make them read better and more meaningful. Normal ref creation codepath can still treat non-zero return values as errors. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs.h')
-rw-r--r--refs.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/refs.h b/refs.h
index 9dc8aa01d1..9cd16f8295 100644
--- a/refs.h
+++ b/refs.h
@@ -52,7 +52,10 @@ int for_each_reflog_ent(const char *ref, each_reflog_ent_fn fn, void *cb_data);
*/
extern int for_each_reflog(each_ref_fn, void *);
-/** Returns 0 if target has the right format for a ref. **/
+#define CHECK_REF_FORMAT_OK 0
+#define CHECK_REF_FORMAT_ERROR (-1)
+#define CHECK_REF_FORMAT_ONELEVEL (-2)
+#define CHECK_REF_FORMAT_WILDCARD (-3)
extern int check_ref_format(const char *target);
/** rename ref, return 0 on success **/