diff --git a/refs.c b/refs.c index da9737f992..8f0b87184b 100644 --- a/refs.c +++ b/refs.c @@ -521,7 +521,8 @@ const char *resolve_ref(const char *ref, unsigned char *sha1, int reading, int * if (len < 0) return NULL; buffer[len] = 0; - if (!prefixcmp(buffer, "refs/")) { + if (!prefixcmp(buffer, "refs/") && + !check_refname_format(buffer, 0)) { strcpy(ref_buffer, buffer); ref = ref_buffer; if (flag)