git: 1b7672ed9929 - stable/14 - diff: honour -B flag with -q

From: Ed Maste <emaste_at_FreeBSD.org>
Date: Fri, 24 May 2024 23:59:23 UTC
The branch stable/14 has been updated by emaste:

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

commit 1b7672ed992963e1c79ccc152f4afd72c91481f3
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2024-05-16 14:53:23 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2024-05-24 23:59:11 +0000

    diff: honour -B flag with -q
    
    PR:             278988
    Reviewed by:    bapt
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D45220
    
    (cherry picked from commit fb623aab3927a6825ff7731198ec2e33426f7607)
---
 usr.bin/diff/diffreg.c          |  3 ++-
 usr.bin/diff/tests/diff_test.sh | 10 ++++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/usr.bin/diff/diffreg.c b/usr.bin/diff/diffreg.c
index 8042003cd836..ffb3f90beede 100644
--- a/usr.bin/diff/diffreg.c
+++ b/usr.bin/diff/diffreg.c
@@ -383,7 +383,8 @@ diffreg(char *file1, char *file2, int flags, int capsicum)
 	}
 
 	if (diff_format == D_BRIEF && ignore_pats == NULL &&
-	    (flags & (D_FOLDBLANKS|D_IGNOREBLANKS|D_IGNORECASE|D_STRIPCR)) == 0)
+	    (flags & (D_FOLDBLANKS|D_IGNOREBLANKS|D_IGNORECASE|
+	    D_SKIPBLANKLINES|D_STRIPCR)) == 0)
 	{
 		rval = D_DIFFER;
 		status |= 1;
diff --git a/usr.bin/diff/tests/diff_test.sh b/usr.bin/diff/tests/diff_test.sh
index 66596bae8a46..c29c0a93d5d8 100755
--- a/usr.bin/diff/tests/diff_test.sh
+++ b/usr.bin/diff/tests/diff_test.sh
@@ -11,6 +11,7 @@ atf_test_case brief_format
 atf_test_case b230049
 atf_test_case stripcr_o
 atf_test_case b252515
+atf_test_case b278988
 atf_test_case Bflag
 atf_test_case Nflag
 atf_test_case tabsize
@@ -89,6 +90,14 @@ b252515_body()
 		diff -qw b252515_a.in b252515_b.in
 }
 
+b278988_body()
+{
+	printf 'a\nb\nn' > b278988.a.in
+	printf 'a\n\nb\nn' > b278988.b.in
+	atf_check -o empty -s eq:0 \
+		diff -Bw b278988.a.in b278988.b.in
+}
+
 header_body()
 {
 	export TZ=UTC
@@ -365,6 +374,7 @@ atf_init_test_cases()
 	atf_add_test_case b230049
 	atf_add_test_case stripcr_o
 	atf_add_test_case b252515
+	atf_add_test_case b278988
 	atf_add_test_case Bflag
 	atf_add_test_case Nflag
 	atf_add_test_case tabsize