diff: fix --exit-code with external diff
commit11be65cfa43416219e85384a3a80d672b65b76ba
authorRené Scharfe <l.s.r@web.de>
Sun, 5 May 2024 10:20:03 +0000 (5 12:20 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 6 May 2024 17:23:42 +0000 (6 10:23 -0700)
tree4e2afc0ee9875b2b9810a128a81154bad9ad8306
parent7b30c3ad2da76bde9f49b049890acac0943d4c76
diff: fix --exit-code with external diff

You can ask the diff machinery to let the exit code indicate whether
there are changes, e.g. with --exit-code.  It as two ways to calculate
that bit: The quick one assumes blobs with different hashes have
different content, and the more elaborate way actually compares the
contents, possibly applying transformations like ignoring whitespace.

Always use the slower path by setting the flag diff_from_contents,
because any of the files could have an external diff driver set via an
attribute, which might consider binary differences irrelevant, like e.g.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff.c
t/t4020-diff-external.sh