Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/refs.c
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2011-09-16 01:10:40 +0400
committerJunio C Hamano <gitster@pobox.com>2011-10-06 00:45:31 +0400
commit629cd3ac6d081b43c8cdb045845be1fedbc89615 (patch)
tree01b03b13fef9519b27eb1c77ac2f8534946ffd37 /refs.c
parent8384d78886eca05cae2a4c1bccaee379d76c1e06 (diff)
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>
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/refs.c b/refs.c
index ee3e0cc560..2387f4e735 100644
--- a/refs.c
+++ b/refs.c
@@ -500,6 +500,7 @@ const char *resolve_ref(const char *ref, unsigned char *sha1, int reading, int *
ssize_t len;
char buffer[256];
static char ref_buffer[256];
+ char path[PATH_MAX];
if (flag)
*flag = 0;
@@ -508,7 +509,6 @@ const char *resolve_ref(const char *ref, unsigned char *sha1, int reading, int *
return NULL;
for (;;) {
- char path[PATH_MAX];
struct stat st;
char *buf;
int fd;
@@ -593,8 +593,10 @@ const char *resolve_ref(const char *ref, unsigned char *sha1, int reading, int *
if (flag)
*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 ref;
}