Merge branch 'tg/rerere'
[gitweb.git] / refs / files-backend.c
index b9eb3aabe6388a6437109439c3ac2ca298853892..1f1a98e4cb0610039e66f24dab59205377d90144 100644 (file)
@@ -363,7 +363,7 @@ static int files_read_raw_ref(struct ref_store *ref_store,
        /* Follow "normalized" - ie "refs/.." symlinks by hand */
        if (S_ISLNK(st.st_mode)) {
                strbuf_reset(&sb_contents);
-               if (strbuf_readlink(&sb_contents, path, 0) < 0) {
+               if (strbuf_readlink(&sb_contents, path, st.st_size) < 0) {
                        if (errno == ENOENT || errno == EINVAL)
                                /* inconsistent with lstat; retry */
                                goto stat_ref;