diff: move the fallback "--exit-code" code down
commit5f107caed755dae950382fdafc76a33b31528caa
authorJunio C Hamano <gitster@pobox.com>
Fri, 18 Aug 2023 23:59:28 +0000 (18 16:59 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sat, 19 Aug 2023 00:01:11 +0000 (18 17:01 -0700)
treecf73f1dc730f9c121701c0c396e7d90bfcd572d9
parent83973981eb475ce90f829f8a5bd6ea99cd3bbd8e
diff: move the fallback "--exit-code" code down

When "--exit-code" is asked and the code cannot just answer by
comparing the object names on both sides but needs to inspect and
compare the contents, there are two ways that the result is found
out.

Some output modes, like "--stat" and "--patch", inherently have to
inspect the contents in order to show the differences in the way
they do.  The codepaths for these modes set the .found_changes bit
as they compute what to show.

However, other output modes do not need to inspect the contents to
show the differences in the way they do.  The most notable example
is "--quiet", which does not need to compute any output to show.
When they are asked to report "--exit-code", they run the codepaths
for the "--patch" output with their output redirected to "/dev/null",
only to set the .found_changes bit.

Currently, this fallback invocation of "--patch" output is done
after the "--stat" output format and its friends and before the
"--patch" and internal callback logic.  Move it to the end of
the sequence to clarify the fallback status of this code block.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff.c