Add --status and --empty-files-as-absent support to scanner-based grepdiff#155
Merged
Add --status and --empty-files-as-absent support to scanner-based grepdiff#155
Conversation
…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 Report❌ Patch coverage is
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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.