Subject: Re: [PATCH 4/5] Make 'diff_populate_filespec()' use the new 'strbuf_readlink()'

From: Junio C Hamano <[email-masked]>
Date: Wed, 17 Dec 2008 12:37:43 -0800

Linus Torvalds <[email-masked]> writes:

> 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.