only textconv regular files

We treat symlinks as text containing the results of the
symlink, so it doesn't make much sense to text-convert them.

Similarly gitlink components just end up as the text
"Subproject commit $sha1", which we should leave intact.

Note that a typechange may be broken into two parts: the
removal of the old part and the addition of the new. In that
case, we _do_ show the textconv for any part which is the
addition or removal of a file we would ordinarily textconv,
since it is purely acting on the file contents.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Jeff King 2008-10-26 00:46:21 -04:00 committed by Junio C Hamano
parent c7534ef4a1
commit 2675773af8
2 changed files with 3 additions and 1 deletions

2
diff.c
View File

@ -1311,6 +1311,8 @@ static const char *get_textconv(struct diff_filespec *one)
{ {
if (!DIFF_FILE_VALID(one)) if (!DIFF_FILE_VALID(one))
return NULL; return NULL;
if (!S_ISREG(one->mode))
return NULL;
diff_filespec_load_driver(one); diff_filespec_load_driver(one);
return one->driver->textconv; return one->driver->textconv;
} }

View File

@ -104,7 +104,7 @@ index ad8b3d2..67be421
\ No newline at end of file \ No newline at end of file
EOF EOF
# make a symlink the hard way that works on symlink-challenged file systems # make a symlink the hard way that works on symlink-challenged file systems
test_expect_failure 'textconv does not act on symlinks' ' test_expect_success 'textconv does not act on symlinks' '
echo -n frotz > file && echo -n frotz > file &&
git add file && git add file &&
git ls-files -s | sed -e s/100644/120000/ | git ls-files -s | sed -e s/100644/120000/ |