[PATCH] diff: use filespec as in-place size cache
- From
Junio C Hamano <junkio@cox.net>
- Date
- May 6, 2007, 08:51 UTC
- Message-ID
- <7vfy6acp32.fsf@assigned-by-dhcp.cox.net>
- In-Reply-To
- <7vr6pucp9e.fsf@assigned-by-dhcp.cox.net>
When we have a filespec primed with size, later size_only request should be fillable without recomputing it.
---
diff --git a/diff.c b/diff.c index 0f8c68f..fb3eba5 100644 --- a/diff.c +++ b/diff.c @@ -1515,6 +1515,9 @@ int diff_populate_filespec(struct diff_filespec *s, int size_only) if (s->data) return err; + if (size_only && 0 < s->size) + return err; + if (S_ISDIRLNK(s->mode)) return diff_populate_gitlink(s, size_only);