Skip to content

Commit

Permalink
refs.c: handle REFNAME_REFSPEC_PATTERN at end of page
Browse files Browse the repository at this point in the history
When a ref crosses a memory page boundary, we restart the parsing
at the beginning with the bytewise code.  Pass the original flags
to that code, rather than the current flags.

Reported-By: Øyvind A. Holm <sunny@sunbase.org>
Signed-off-by: David Turner <dturner@twitter.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
David Turner authored and Junio C Hamano committed Jul 7, 2014
1 parent 745224e commit 6d17dc1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion refs.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ int check_refname_format(const char *refname, int flags)
const __m128i tilde_lb = _mm_set1_epi8('~' - 1);

int component_count = 0;
int orig_flags = flags;

if (refname[0] == 0 || refname[0] == '/') {
/* entirely empty ref or initial ref component */
Expand All @@ -178,7 +179,7 @@ int check_refname_format(const char *refname, int flags)
* End-of-page; fall back to slow method for
* this entire ref.
*/
return check_refname_format_bytewise(refname, flags);
return check_refname_format_bytewise(refname, orig_flags);

tmp = _mm_loadu_si128((__m128i *)cp);
tmp1 = _mm_loadu_si128((__m128i *)(cp + 1));
Expand Down

0 comments on commit 6d17dc1

Please sign in to comment.