Skip to content

Conversation

@twaugh
Copy link
Owner

@twaugh twaugh commented Oct 21, 2025

No description provided.

…pdiff

Implement the -s/--status option for grepdiff in the scanner-based
implementation (when --enable-scanner-patchfilter is used). This option
displays file status indicators:
  + for file additions
  - for file deletions
  ! for file modifications

Also implement --empty-files-as-absent option which works with -s to
treat files with empty content as absent, affecting status determination.
For example, a file with only additions in the first hunk becomes a new
file (+) instead of a modification (!).

Key implementation details:
- Added show_status and empty_files_as_absent global flags
- Extended buffered_file structure to track initial_status, orig_is_empty,
  and new_is_empty
- Empty file detection examines only the first hunk (orig_count == 0 or
  new_count == 0 indicates an empty file)
- Status calculation uses determine_file_status() from headers, then
  adjusts based on empty file logic if --empty-files-as-absent is set
- Output uses display_filename_extended() to show status prefix

This change allows tests/grepdiff-status/run-test to pass, so it has
been removed from XFAIL_TESTS in Makefile.am.

Tested with all 6 test cases in grepdiff-status, covering unified diffs,
context diffs, and --empty-files-as-absent edge cases.

Assisted-by: Claude Code
@codecov
Copy link

codecov bot commented Oct 21, 2025

Codecov Report

❌ Patch coverage is 91.42857% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.47%. Comparing base (b34e833) to head (59b70e5).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/grep.c 91.42% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #155      +/-   ##
==========================================
+ Coverage   86.45%   86.47%   +0.01%     
==========================================
  Files          15       15              
  Lines        8143     8176      +33     
  Branches     1646     1656      +10     
==========================================
+ Hits         7040     7070      +30     
- Misses       1103     1106       +3     
Flag Coverage Δ
unittests 86.47% <91.42%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@twaugh twaugh merged commit 487f3e8 into master Oct 21, 2025
8 checks passed
@twaugh twaugh deleted the grepdiff-status-support branch October 21, 2025 11:04
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.

2 participants