Re: [PATCH 4/5] Make 'diff_populate_filespec()' use the new 'strbuf_readlink()'
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Dec 17, 2008, 20:37 UTC
- Message-ID
- <7vmyeuleqw.fsf@gitster.siamese.dyndns.org>
- In-Reply-To
- <alpine.LFD.2.00.0812171043440.14014@localhost.localdomain>
Linus Torvalds <torvalds@linux-foundation.org> writes:
Show 15 quoted lines
> diff --git a/diff.c b/diff.c
> index afefe08..4b2029c 100644
> --- a/diff.c
> +++ b/diff.c
> @@ -1773,19 +1773,17 @@ int diff_populate_filespec(struct diff_filespec *s, int size_only)
> s->size = xsize_t(st.st_size);
> if (!s->size)
> goto empty;
> - if (size_only)
> - return 0;
> if (S_ISLNK(st.st_mode)) {
> ...
> }
> + if (size_only)
> + return 0;It is unfortunate that we need to always readlink even when we only would want to cull differences early (e.g. --raw without any fancy filters such as rename detection), but symbolic links should be minorities in any sane repo, and it should not be worth trying to optimize this for sane filesystems by making it conditional.