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>
Michael Haggerty committed
Jan 6, 2017 at 17:22 UTC
15ee2c72e76fa79e957990b43277a4591371e70e
1 file changed
+6
-5
refs/refs-internal.h
+6
-5
@@ -62,11 +62,12 @@
62
* This function does not check that the reference name is legal; for
63
* that, use check_refname_format().
64
*
65
- * We consider a refname that starts with "refs/" to be safe as long
66
- * as any ".." components that it might contain do not escape "refs/".
67
- * Names that do not start with "refs/" are considered safe iff they
68
- * consist entirely of upper case characters and '_' (like "HEAD" and
69
- * "MERGE_HEAD" but not "config" or "FOO/BAR").
65
+ * A refname that starts with "refs/" is considered safe iff it
66
+ * doesn't contain any "." or ".." components or consecutive '/'
67
+ * characters, end with '/', or (on Windows) contain any '\'
68
+ * characters. Names that do not start with "refs/" are considered
69
+ * safe iff they consist entirely of upper case characters and '_'
70
+ * (like "HEAD" and "MERGE_HEAD" but not "config" or "FOO/BAR").
71
*/
72
int refname_is_safe(const char *refname);
73