Conversation
Both `git_diff_file` and `git_diff_commit` previously had only one escape hatch when a diff exceeded the 500-line truncation cap: the `pattern` grep parameter. That left no way to inspect a specific region of a large diff without already knowing what to search for. This change adds `start_line` and `end_line` parameters to both tools, mirroring the interface of `fs_read_file`. When either bound is supplied, the diff is sliced to that 1-based output-line window before any further processing, and the truncation cap is bypassed entirely — the caller owns their window size. Slice markers are injected last (`... (starting from line #N) ...` / `... (truncated after line #M) ...`) so they survive an intermediate `pattern` grep. The two features compose: when both a range and a `pattern` are given, the diff is sliced first and `pattern` greps within that slice. This lets the model page to a known region and then narrow further. Three new helpers in `diff_filter.rs` carry the implementation: `validate_line_range` (static cross-cut checks), `slice_diff` (extracts the line window), and `add_slice_markers` (appends the context markers). The truncation note now surfaces both escape hatches so the model knows to use `start_line`/`end_line` when it hits the cap. Tool schemas and the `git-reading` skill description are updated to document the new parameters and include paging/compose examples. Signed-off-by: Jean Mertz <git@jeanmertz.com>
Signed-off-by: Jean Mertz <git@jeanmertz.com>
Signed-off-by: Jean Mertz <git@jeanmertz.com>
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.
Both
git_diff_fileandgit_diff_commitpreviously had only one escape hatch when a diff exceeded the 500-line truncation cap: thepatterngrep parameter. That left no way to inspect a specific region of a large diff without already knowing what to search for.This change adds
start_lineandend_lineparameters to both tools, mirroring the interface offs_read_file. When either bound is supplied, the diff is sliced to that 1-based output-line window before any further processing, and the truncation cap is bypassed entirely — the caller owns their window size. Slice markers are injected last (... (starting from line #N) .../... (truncated after line #M) ...) so they survive an intermediatepatterngrep.The two features compose: when both a range and a
patternare given, the diff is sliced first andpatterngreps within that slice. This lets the model page to a known region and then narrow further.Three new helpers in
diff_filter.rscarry the implementation:validate_line_range(static cross-cut checks),slice_diff(extracts the line window), andadd_slice_markers(appends the context markers). The truncation note now surfaces both escape hatches so the model knows to usestart_line/end_linewhen it hits the cap.Tool schemas and the
git-readingskill description are updated to document the new parameters and include paging/compose examples.