Subject: Re: [PATCH 3/5] refactor userdiff textconv code

From: Johannes Sixt <[email-masked]>
Date: Fri, 24 Oct 2008 16:01:59 +0200

Jeff King schrieb:
> On Fri, Oct 24, 2008 at 09:15:54AM +0200, Johannes Sixt wrote:
> Actually, I don't think this is right. The typechange has been broken
> into two parts: the removal of the file contents and the addition of the
> symlink. So the first part _should_ use the textconv, since it is just
> comparing the file contents to /dev/null. But the second part should
> not, since it is by definition just the text of the symlink. Ditto for
> gitlinks, which have a special text representation. So how about this?

Your reasoning makes sense, of course. (I thought that forgoing textconv
in these cases would have a simpler implementation; but it can't be a lot
simpler than yours.)

> diff --git a/diff.c b/diff.c
> index 52feba7..ce1317d 100644
> --- a/diff.c
> +++ b/diff.c
> @@ -289,6 +289,9 @@ static int diff_filespec_textconv(struct diff_filespec *one)
>  	if (!DIFF_FILE_VALID(one))
>  		return 0;
>  
> +	if (!S_ISREG(one->mode))
> +		return 0;
> +
>  	diff_filespec_load_driver(one);
>  	if (!one->driver->textconv)
>  		return 0;
...
> +test_expect_failure 'textconv does not act on symlinks' '

Can we trust your solution if you still have 'test_expect_failure' here? ;-)

-- Hannes