git: ec1754a677a0 - main - diff: diff regular files when `-q` is specified again

From: Enji Cooper <ngie_at_FreeBSD.org>
Date: Tue, 20 Oct 2026 17:40:59 UTC
The branch main has been updated by ngie:

URL: https://cgit.FreeBSD.org/src/commit/?id=ec1754a677a0bebb735d752583ad625150114eee

commit ec1754a677a0bebb735d752583ad625150114eee
Author:     Enji Cooper <ngie@FreeBSD.org>
AuthorDate: 2026-10-20 17:37:12 +0000
Commit:     Enji Cooper <ngie@FreeBSD.org>
CommitDate: 2026-10-20 17:40:47 +0000

    diff: diff regular files when `-q` is specified again
    
    c30a321a61ce accidentally modified the code paths when diffing regular
    files to not diff them if `-q` was specified. Call `diffreg(..)` again,
    regardless of whether or not `-q` was specified to restore the
    functionality pre-c30a321a61ce, while only printing out the result to
    the console if `-q` is not specified.
    
    This change unbreaks diff so 2 files which differ are reported again via
    the exit code when with `-q` is specified.
    
    MFC after:      3 days
    PR:             299643
    Reviewed by:    des
    Differential Revision: https://reviews.freebsd.org/D60910
    Fixes: c30a321a61ce ("diff: support -qq to output absolutely nothing")
---
 usr.bin/diff/diff.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/usr.bin/diff/diff.c b/usr.bin/diff/diff.c
index cf3e4ec1f11a..501a1f6ef0f8 100644
--- a/usr.bin/diff/diff.c
+++ b/usr.bin/diff/diff.c
@@ -139,7 +139,7 @@ main(int argc, char **argv)
 {
 	const char *errstr;
 	char **oargv;
-	int ch, dflags, lastch, gotstdin, prevoptind, newarg;
+	int ch, dflags, error, lastch, gotstdin, prevoptind, newarg;
 
 	oargv = argv;
 	gotstdin = 0;
@@ -480,9 +480,9 @@ main(int argc, char **argv)
 				err(2, "%s", argv[1]);
 		}
 
+		error = diffreg(argv[0], argv[1], dflags, 1);
 		if (diff_format != D_QUIET)
-			print_status(diffreg(argv[0], argv[1], dflags, 1),
-			    argv[0], argv[1], "");
+			print_status(error, argv[0], argv[1], "");
 	}
 	if (fflush(stdout) != 0)
 		err(2, "stdout");