Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 18 May 2024 00:05:31 GMT
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: fb623aab3927 - main - diff: honour -B flag with -q
Message-ID:  <202405180005.44I05VSN061665@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by emaste:

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

commit fb623aab3927a6825ff7731198ec2e33426f7607
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2024-05-16 14:53:23 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2024-05-18 00:03:56 +0000

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

diff --git a/usr.bin/diff/diffreg.c b/usr.bin/diff/diffreg.c
index 06d914215b11..6073feebf5fb 100644
--- a/usr.bin/diff/diffreg.c
+++ b/usr.bin/diff/diffreg.c
@@ -408,7 +408,8 @@ diffreg_stone(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 146c23fa303d..9a17d180da02 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,15 @@ 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
@@ -369,6 +379,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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202405180005.44I05VSN061665>