refs.c: handle REFNAME_REFSPEC_PATTERN at end of page

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>

David Turner committed Jul 5, 2014 at 12:00 UTC 6d17dc1dd3909a9e8a5a915a6ff15d4c64c58290
1 file changed +2 -1
refs.c
+2 -1
@@ -153,6 +153,7 @@ int check_refname_format(const char *refname, int flags)
153 const __m128i tilde_lb = _mm_set1_epi8('~' - 1);
154
155 int component_count = 0;
156 + int orig_flags = flags;
157
158 if (refname[0] == 0 || refname[0] == '/') {
159 /* entirely empty ref or initial ref component */
@@ -178,7 +179,7 @@ int check_refname_format(const char *refname, int flags)
179 * End-of-page; fall back to slow method for
180 * this entire ref.
181 */
181 - return check_refname_format_bytewise(refname, flags);
182 + return check_refname_format_bytewise(refname, orig_flags);
183
184 tmp = _mm_loadu_si128((__m128i *)cp);
185 tmp1 = _mm_loadu_si128((__m128i *)(cp + 1));