From: Junio C Hamano Date: Sat, 21 Mar 2009 23:15:12 GMT Subject: Re: [PATCH 1/7] check_ref_format(): tighten refname rules Message-ID: <7vwsaibh8f.fsf@gitster.siamese.dyndns.org> In-Reply-To: <1237673619-12608-2-git-send-email-gitster@pobox.com> Junio C Hamano writes: > diff --git a/refs.c b/refs.c > index 8d3c502..abd5623 100644 > --- a/refs.c > +++ b/refs.c > @@ -717,19 +717,23 @@ int check_ref_format(const char *ref) > return CHECK_REF_FORMAT_ERROR; > } > > + last = ch; > /* scan the rest of the path component */ > while ((ch = *cp++) != 0) { > bad_type = bad_ref_char(ch); > - if (bad_type) { > + if (bad_type) > return CHECK_REF_FORMAT_ERROR; > - } > if (ch == '/') > break; > - if (ch == '.' && *cp == '.') > + if (last == '.' && ch == '.') > + return CHECK_REF_FORMAT_ERROR; > + if (last == '@' && ch == '{') > return CHECK_REF_FORMAT_ERROR; Oops; here I need: + last = ch; here. > }