Enhance Git Integration: Add --git-diff and --git-only Options #2
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.
Overview
This PR enhances llmcat's Git integration by introducing three key features:
--git-diff:
When enabled, the script appends Git diff output for each processed file that is tracked in the repository. If a file has no changes, a message is shown indicating that there are no Git modifications.
--git-only:
In interactive mode, this flag restricts the file listing to only those files with modifications (as determined by
git status --porcelain), helping users focus on relevant changes..gitignore Filtering:
The interactive mode now reads the repository’s .gitignore file and filters out any files or directories that match its patterns. This ensures that ignored files do not clutter the selection list.
Changes Made
Argument Parsing:
--git-diffand--git-onlyflags.Interactive Mode Adjustments:
--git-onlyflag is active, the interactive file listing is generated usinggit statusto only display changed files.File Processing Enhancements:
process_file()function has been updated to rungit diffon each file (if the--git-diffflag is set and the file is tracked). Diff output is appended (wrapped in Markdown code fences for diff syntax highlighting), or a message is printed if there are no changes.Benefits
Focused Diff Viewing:
Users can see Git diffs only for files that have been modified, making it easier to identify changes.
Cleaner Interactive Selection:
With the combined use of
--git-onlyand .gitignore filtering, the interactive mode displays a streamlined list of only relevant, non-ignored, modified files.Testing
--git-diffappends the Git diff output for files with changes.--git-onlylimits the interactive file listing to only changed files.Please review these changes and let me know if you have any feedback or suggestions.