It's out of context, but there are neither changes in buffer nor buf
between two chunks.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclo...@gmail.com>
---
 refs.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/refs.c b/refs.c
index 5e378bc..1fb658f 100644
--- a/refs.c
+++ b/refs.c
@@ -1339,7 +1339,7 @@ const char *resolve_ref_unsafe(const char *refname, 
unsigned char *sha1, int rea
        for (;;) {
                char path[PATH_MAX];
                struct stat st;
-               char *buf;
+               const char *buf;
                int fd;
 
                if (--depth < 0)
@@ -1415,7 +1415,7 @@ const char *resolve_ref_unsafe(const char *refname, 
unsigned char *sha1, int rea
                /*
                 * Is it a symbolic ref?
                 */
-               if (!starts_with(buffer, "ref:")) {
+               if ((buf = skip_prefix(buffer, "ref:")) == NULL) {
                        /*
                         * Please note that FETCH_HEAD has a second
                         * line containing other data.
@@ -1430,7 +1430,6 @@ const char *resolve_ref_unsafe(const char *refname, 
unsigned char *sha1, int rea
                }
                if (flag)
                        *flag |= REF_ISSYMREF;
-               buf = buffer + 4;
                while (isspace(*buf))
                        buf++;
                if (check_refname_format(buf, REFNAME_ALLOW_ONELEVEL)) {
-- 
1.8.5.1.208.g019362e

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to