Skip to content

Conversation

@doganarif
Copy link

Overview

This PR enhances llmcat's Git integration by introducing three key features:

  1. --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.

  2. --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.

  3. .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:

    • Added support for the --git-diff and --git-only flags.
  • Interactive Mode Adjustments:

    • When the --git-only flag is active, the interactive file listing is generated using git status to only display changed files.
    • The script now reads and parses the .gitignore file (from the repository root) and appends a regex filter to the file-finding command to skip ignored files.
  • File Processing Enhancements:

    • The process_file() function has been updated to run git diff on each file (if the --git-diff flag 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-only and .gitignore filtering, the interactive mode displays a streamlined list of only relevant, non-ignored, modified files.

Testing

  • Verified that enabling --git-diff appends the Git diff output for files with changes.
  • Confirmed that --git-only limits the interactive file listing to only changed files.
  • Ensured that files matching the .gitignore rules are correctly filtered out from the interactive selection.

Please review these changes and let me know if you have any feedback or suggestions.

- Introduce --git-diff flag to append Git diff output for modified files.
- Introduce --git-only flag to restrict interactive selection to only changed files.
- Integrate .gitignore support in interactive mode to skip ignored files.
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.

1 participant