Re: [PATCH 24/43] refs.h: document make refname_is_safe and add it to header
- From
David Turner <dturner@twopensource.com>
- Date
- Sep 3, 2015, 02:06 UTC
- Message-ID
- <1441245976.25570.24.camel@twopensource.com>
- In-Reply-To
- <1441245313-11907-25-git-send-email-dturner@twopensource.com>
And, of course, as soon as I send these, I notice the bad signoff on about half of them, including this one :( Those probably got screwed up when I ended up losing my entire repo once when a test went wrong.
Anyway, I went ahead and fixed them in my local version, so next rev they'll be fine.
On Wed, 2015-09-02 at 21:54 -0400, David Turner wrote:
Show 29 quoted lines
> This function might be used by other refs backends > > Signed-off-by: David Turner <dturner@twitter.com> > --- > refs.h | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/refs.h b/refs.h > index 5542587..359e166 100644 > --- a/refs.h > +++ b/refs.h > @@ -259,6 +259,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.