Skip to content

diff: implement -B / --ignore-blank-lines - #426

Closed
yunusarda-sudo wants to merge 1 commit into
uutils:mainfrom
yunusarda-sudo:fix/ignore-blank-lines
Closed

yunusarda-sudo wants to merge 1 commit into
uutils:mainfrom
yunusarda-sudo:fix/ignore-blank-lines

Conversation

@yunusarda-sudo

Copy link
Copy Markdown

Fixes #407

Description

Adds support for -B and --ignore-blank-lines in diff.
When this option is enabled, diff suppresses/drops hunks whose inserted and deleted lines are all blank (empty), matching GNU diff behavior.

Changes

  • Added ignore_blank_lines to Params in src/params.rs and parsed -B / --ignore-blank-lines.
  • Filtered hunks whose changes are all blank in normal_diff, unified_diff, context_diff, and ed_diff.
  • In brief mode (-q), only stop early if !params.ignore_blank_lines so blank-only differences do not falsely report files as different.
  • Added unit test in src/params.rs and integration test in tests/by-util/test_diff.rs covering normal, unified, context, ed, brief formats, and Bug#18402 (non-blank changes without final newline).

Add support for -B and --ignore-blank-lines to ignore changes whose
inserted and deleted lines are all blank across normal, unified, context,
and ed diff formats.

Fixes uutils#407
@shadowmkj

Copy link
Copy Markdown
Contributor

Again, duplicate of #419? Is this some kind of AI agent running in the background?

@yunusarda-sudo

Copy link
Copy Markdown
Author

Closing as duplicate of #419; consolidating work there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

diff - -B / --ignore-blank-lines is not implemented

2 participants