Re: [PATCH v3 25/44] refs.h: document make refname_is_safe and add it to header
- From
Michael Haggerty <mhagger@alum.mit.edu>
- Date
- Oct 13, 2015, 09:18 UTC
- Message-ID
- <561CCC63.8050604@alum.mit.edu>
- In-Reply-To
- <561CB3C4.1010208@alum.mit.edu>
On 10/13/2015 09:33 AM, Michael Haggerty wrote:
Show 36 quoted lines
> On 10/12/2015 11:51 PM, David Turner wrote: >> This function might be used by other refs backends >> >> Signed-off-by: David Turner <dturner@twopensource.com> >> --- >> refs.h | 11 +++++++++++ >> 1 file changed, 11 insertions(+) >> >> diff --git a/refs.h b/refs.h >> index fc8a748..7a936e2 100644 >> --- a/refs.h >> +++ b/refs.h >> @@ -348,6 +348,17 @@ int verify_refname_available(const char *newname, struct string_list *extra, >> struct string_list *skip, struct strbuf *err); >> >> /* >> + * Check if a refname is safe. >> + * For refs that start with "refs/" we consider it safe as long they do >> + * not try to resolve to outside of refs/. >> + * >> + * For all other refs we only consider them safe iff they only contain >> + * upper case characters and '_' (like "HEAD" AND "MERGE_HEAD", and not like >> + * "config"). >> + */ >> +int refname_is_safe(const char *refname); >> + >> +/* >> * Flags controlling ref_transaction_update(), ref_transaction_create(), etc. >> * REF_NODEREF: act on the ref directly, instead of dereferencing >> * symbolic references. >> > > The previous commit deleted this comment from where it previously > appeared in refs-be-files.c. It would make more sense to squash this > commit onto that one so it's clear that you are moving the comment > rather than creating a new comment out of thin air.
Also, after this commit the prototype for this function appears twice in refs.h.
Michael
-- Michael Haggerty mhagger@alum.mit.edu