summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2017-01-06 17:22:22 +0100
committerJunio C Hamano <gitster@pobox.com>2017-01-07 19:30:08 -0800
commit15ee2c72e76fa79e957990b43277a4591371e70e (patch)
tree242a1d2e9e23e6b1492f2580c905ffb945d010dc
parent583643248a28c5d3f678fdd042a63e5d1c48f39e (diff)
downloadgit-15ee2c72e76fa79e957990b43277a4591371e70e.tar.gz
refname_is_safe(): correct docstring
The behavior of refname_is_safe() was changed in e40f355 "refname_is_safe(): insist that the refname already be normalized", 2016-04-27 without a corresponding update to its docstring. The function is in fact stricter than documented, because it now insists that the result of normalizing the part of a refname following "refs/" is identical to that part of the original refname. Fix the docstring. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--refs/refs-internal.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/refs/refs-internal.h b/refs/refs-internal.h
index 708b26082a..dc81acc902 100644
--- a/refs/refs-internal.h
+++ b/refs/refs-internal.h
@@ -62,11 +62,12 @@
* This function does not check that the reference name is legal; for
* that, use check_refname_format().
*
- * We consider a refname that starts with "refs/" to be safe as long
- * as any ".." components that it might contain do not escape "refs/".
- * Names that do not start with "refs/" are considered safe iff they
- * consist entirely of upper case characters and '_' (like "HEAD" and
- * "MERGE_HEAD" but not "config" or "FOO/BAR").
+ * A refname that starts with "refs/" is considered safe iff it
+ * doesn't contain any "." or ".." components or consecutive '/'
+ * characters, end with '/', or (on Windows) contain any '\'
+ * characters. Names that do not start with "refs/" are considered
+ * safe iff they consist entirely of upper case characters and '_'
+ * (like "HEAD" and "MERGE_HEAD" but not "config" or "FOO/BAR").
*/
int refname_is_safe(const char *refname);