aboutsummaryrefslogtreecommitdiff
path: root/refs.h
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2011-09-15 23:10:43 +0200
committerJunio C Hamano <gitster@pobox.com>2011-10-05 13:45:31 -0700
commitdce4bab6567de7c458b334e029e3dedcab5f2648 (patch)
tree07996946ea2e23d0f26601782647d9eed5c6ac2d /refs.h
parent7cb368421f62318f2c0f0e19a83ca34c201aebaa (diff)
downloadgit-dce4bab6567de7c458b334e029e3dedcab5f2648.tar.gz
git-dce4bab6567de7c458b334e029e3dedcab5f2648.tar.xz
add_ref(): verify that the refname is formatted correctly
In add_ref(), verify that the refname is formatted correctly before adding it to the ref_list. Here we have to allow refname components that start with ".", since (for example) the remote protocol uses synthetic reference name ".have". So add a new REFNAME_DOT_COMPONENT flag that can be passed to check_refname_format() to allow leading dots. 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.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/refs.h b/refs.h
index b0da5fc95..d5ac13333 100644
--- a/refs.h
+++ b/refs.h
@@ -99,6 +99,7 @@ extern int for_each_reflog(each_ref_fn, void *);
#define REFNAME_ALLOW_ONELEVEL 1
#define REFNAME_REFSPEC_PATTERN 2
+#define REFNAME_DOT_COMPONENT 4
/*
* Return 0 iff ref has the correct format for a refname according to
@@ -106,7 +107,10 @@ extern int for_each_reflog(each_ref_fn, void *);
* REFNAME_ALLOW_ONELEVEL is set in flags, then accept one-level
* reference names. If REFNAME_REFSPEC_PATTERN is set in flags, then
* allow a "*" wildcard character in place of one of the name
- * components. No leading or repeated slashes are accepted.
+ * components. No leading or repeated slashes are accepted. If
+ * REFNAME_DOT_COMPONENT is set in flags, then allow refname
+ * components to start with "." (but not a whole component equal to
+ * "." or "..").
*/
extern int check_refname_format(const char *ref, int flags);