resolve_ref(): emit warnings for improperly-formatted references
While resolving references, if a reference is found that is in an unrecognized format, emit a warning (and then fail, as before). Wouldn't *you* want to know? Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
8384d78886
commit
629cd3ac6d
6
refs.c
6
refs.c
@ -500,6 +500,7 @@ const char *resolve_ref(const char *ref, unsigned char *sha1, int reading, int *
|
|||||||
ssize_t len;
|
ssize_t len;
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
static char ref_buffer[256];
|
static char ref_buffer[256];
|
||||||
|
char path[PATH_MAX];
|
||||||
|
|
||||||
if (flag)
|
if (flag)
|
||||||
*flag = 0;
|
*flag = 0;
|
||||||
@ -508,7 +509,6 @@ const char *resolve_ref(const char *ref, unsigned char *sha1, int reading, int *
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
char path[PATH_MAX];
|
|
||||||
struct stat st;
|
struct stat st;
|
||||||
char *buf;
|
char *buf;
|
||||||
int fd;
|
int fd;
|
||||||
@ -593,8 +593,10 @@ const char *resolve_ref(const char *ref, unsigned char *sha1, int reading, int *
|
|||||||
if (flag)
|
if (flag)
|
||||||
*flag |= REF_ISSYMREF;
|
*flag |= REF_ISSYMREF;
|
||||||
}
|
}
|
||||||
if (get_sha1_hex(buffer, sha1))
|
if (get_sha1_hex(buffer, sha1)) {
|
||||||
|
warning("reference in %s is formatted incorrectly", path);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
return ref;
|
return ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user