Skip to content

diff: add -I/--ignore-matching-lines - #402

Open
ilainy wants to merge 4 commits into
uutils:mainfrom
ilainy:add-ignore-matching-lines
Open

ilainy wants to merge 4 commits into
uutils:mainfrom
ilainy:add-ignore-matching-lines

Conversation

@ilainy

@ilainy ilainy commented Nov 16, 2026

Copy link
Copy Markdown

GNU diff's -I / --ignore-matching-lines drops a hunk when all its inserted and deleted lines match the given BRE. This PR adds the four forms of the option, makes it repeatable, and implements hunk filtering for the normal output format.

Invalid BREs now exit with code 2 (e.g. '\': Trailing backslash), and when all hunks are dropped the exit status stays 1 because the files still differ.

I only covered the normal format for now. Unified/context output requires rewriting how hunks are built, so I left that for a follow-up.

The missing diff: prefix on usage errors is tracked in #394.

Closes #395.

@github-actions

Copy link
Copy Markdown

GNU diffutils testsuite comparison:

Test results comparison:
  Current:   TOTAL: 33 / PASSED: 20 / FAILED: 9 / SKIPPED: 4
  Reference: TOTAL: 33 / PASSED: 19 / FAILED: 10 / SKIPPED: 4

Changes from main branch:
  TOTAL: +0
  PASSED: +1
  FAILED: -1

Test improvements (1):
  + ignore-matching-lines

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 - -I / --ignore-matching-lines is not implemented

1 participant