You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
scanner: Add context field to patch_hunk_line for better context diff handling
Add enum patch_line_context and context field to struct patch_hunk_line
to explicitly represent which file version a line belongs to:
- PATCH_CONTEXT_BOTH: Normal lines (applies to both old and new versions)
- PATCH_CONTEXT_OLD: Lines representing the old file state
- PATCH_CONTEXT_NEW: Lines representing the new file state
For context diffs, this eliminates ambiguity about changed lines ('!'):
- Old section lines are emitted with PATCH_CONTEXT_OLD
- New section lines are emitted with PATCH_CONTEXT_NEW
- Each line is emitted exactly once with appropriate context
This simplifies consumer logic by providing explicit context information
instead of requiring manual handling of context diff dual-nature semantics.
Updated scanner_debug utility and documentation to reflect the new API.
Fixed test expectations to match the corrected emission behavior.
Assisted-by: Cursor
0 commit comments