diff options
-rw-r--r-- | update-ref.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/update-ref.c b/update-ref.c index 1863b82324..6919cead4b 100644 --- a/update-ref.c +++ b/update-ref.c @@ -13,6 +13,7 @@ static const char *resolve_ref(const char *path, unsigned char *sha1) for (;;) { struct stat st; + char *buf; int fd; if (--depth < 0) @@ -44,7 +45,19 @@ static const char *resolve_ref(const char *path, unsigned char *sha1) return NULL; len = read(fd, buffer, sizeof(buffer)-1); close(fd); - break; + + /* + * Is it a symbolic ref? + */ + if (len < 4 || memcmp("ref:", buffer, 4)) + break; + buf = buffer + 4; + len -= 4; + while (len && isspace(*buf)) + buf++, len--; + while (len && isspace(buf[len-1])) + buf[--len] = 0; + path = git_path("%.*s", len, buf); } if (len < 40 || get_sha1_hex(buffer, sha1)) return NULL; |