Add a documentat on how to revert a faulty merge
[gitweb.git] / builtin-apply.c
index 4c4d1e1774ade358dbc3283df5d1b764a32821b8..07244b0736047d6cfe67db7f059f7755906579f0 100644 (file)
@@ -1559,10 +1559,8 @@ static int read_old_data(struct stat *st, const char *path, struct strbuf *buf)
 {
        switch (st->st_mode & S_IFMT) {
        case S_IFLNK:
-               strbuf_grow(buf, st->st_size);
-               if (readlink(path, buf->buf, st->st_size) != st->st_size)
-                       return -1;
-               strbuf_setlen(buf, st->st_size);
+               if (strbuf_readlink(buf, path, st->st_size) < 0)
+                       return error("unable to read symlink %s", path);
                return 0;
        case S_IFREG:
                if (strbuf_read_file(buf, path, st->st_size) != st->st_size)