Skip to content

Commit

Permalink
diff: honour -B flag with -q
Browse files Browse the repository at this point in the history
PR:		278988
Reviewed by:	bapt
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45220
  • Loading branch information
emaste committed May 18, 2024
1 parent 64a00f8 commit fb623aa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion usr.bin/diff/diffreg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
11 changes: 11 additions & 0 deletions usr.bin/diff/tests/diff_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit fb623aa

Please sign in to comment.