]> git.ipfire.org Git - thirdparty/git.git/commit - diff.c
diff: do not short-cut CHECK_SIZE_ONLY check in diff_populate_filespec()
authorJunio C Hamano <gitster@pobox.com>
Wed, 1 Mar 2017 17:04:44 +0000 (18:04 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 2 Mar 2017 18:48:06 +0000 (10:48 -0800)
commit12426e114b252d130d83c3f098c4ceae3cf217e3
treeb87b7d45487b8c1bea1d33f0336b214d7f3de78c
parent0b65a8dbdb38962e700ee16776a3042beb489060
diff: do not short-cut CHECK_SIZE_ONLY check in diff_populate_filespec()

Callers of diff_populate_filespec() can choose to ask only for the
size of the blob without grabbing the blob data, and the function,
after running lstat() when the filespec points at a working tree
file, returns by copying the value in size field of the stat
structure into the size field of the filespec when this is the case.

However, this short-cut cannot be taken if the contents from the
path needs to go through convert_to_git(), whose resulting real blob
data may be different from what is in the working tree file.

As "git diff --quiet" compares the .size fields of filespec
structures to skip content comparison, this bug manifests as a
false "there are differences" for a file that needs eol conversion,
for example.

Reported-by: Mike Crowe <mac@mcrowe.com>
Helped-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff.c
t/t4035-diff-quiet.sh