Skip to content

feat: add --changed-only/-c flag#41

Merged
llimllib merged 2 commits intomainfrom
feature-changed-only
Apr 7, 2026
Merged

feat: add --changed-only/-c flag#41
llimllib merged 2 commits intomainfrom
feature-changed-only

Conversation

@llimllib
Copy link
Copy Markdown
Owner

@llimllib llimllib commented Apr 7, 2026

Adds a --changed-only / -c flag to filter output to only show files that appear in git status.

Features

  • New flag: --changed-only / -c to show only changed files
  • Shows modified, added, deleted, renamed, copied, untracked, and ignored files
  • Excludes unmodified tracked files

Performance Optimizations

  • Skip git log for files without history:
    • Ignored files (I) - not tracked by git
    • Untracked files (??) - not yet in git
    • .git directory (*) - git metadata
    • Newly added files (A , AM, AD) - staged but not committed

Testing

  • All existing tests pass
  • New tests for filtering logic
  • Tested in large production repository with 2.5 years of history

Usage

git-ls --changed-only
git-ls -c              # short form

llimllib added 2 commits April 7, 2026 09:53
- Add --changed-only/-c flag to filter output to only changed files
- Skip git log for files without meaningful history:
  * Ignored files (I) - not tracked by git
  * Untracked files (??) - not yet in git
  * .git directory (*) - git metadata
  * Newly added files (A*, AM, AD) - staged but not committed
- Early filtering before git log reduces work significantly
- Performance: 2.5s -> 1.5s in large repos (40% improvement)
- Add comprehensive tests for filtering logic
@llimllib llimllib added the enhancement New feature or request label Apr 7, 2026
@llimllib llimllib merged commit f8aee68 into main Apr 7, 2026
1 check passed
@llimllib llimllib deleted the feature-changed-only branch April 7, 2026 14:02
llimllib added a commit that referenced this pull request Apr 8, 2026
…y was added (#43)

- The `filesNeedingLog` filter introduced with `--changed-only` (#41) inadvertently excluded unmodified tracked files (empty `status`). For an empty string, `strings.SplitSeq` yields `""`, the `len(status) > 0` guard is false, `allNew` stays `true`, and the file is dropped from the git log query — so hash/author/message show up blank.
- Fix adds an explicit `status == ""` guard that includes clean tracked files in `filesNeedingLog` before the `allNew` logic runs.
- Adds `TestUnmodifiedFileGetsGitInfo`, an integration test that creates a real repo, commits a file, runs the full filtering pipeline, and asserts the file gets its commit info populated. This test would have caught the regression.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant