--- diff.c | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-) diff --git a/diff.c b/diff.c index 170ec5a..c8132a4 100644 --- a/diff.c +++ b/diff.c @@ -1319,8 +1319,18 @@ int diff_populate_filespec(struct diff_filespec *s, int size_only) locate_size_cache(s->sha1, 0, s->size); } else { - s->data = read_sha1_file(s->sha1, type, &s->size); - s->should_free = 1; + if (S_ISLNK(s->mode)) { + int linksize; + char *linkdata = read_sha1_file(s->sha1, type, &linksize); + s->size = locallen(linkdata, linksize); + s->data = xmalloc(s->size + 1); + localcpy(s->data, linkdata, linksize + 1); + s->should_free = 1; + free(linkdata); + } else { + s->data = read_sha1_file(s->sha1, type, &s->size); + s->should_free = 1; + } } } return 0; -- 1.6.3.dirty -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html