Skip to content

fix: unmodified tracked files show no commit info after --changed-only was added#43

Merged
llimllib merged 1 commit intomainfrom
fix-unmodified-files-git-info
Apr 8, 2026
Merged

fix: unmodified tracked files show no commit info after --changed-only was added#43
llimllib merged 1 commit intomainfrom
fix-unmodified-files-git-info

Conversation

@llimllib
Copy link
Copy Markdown
Owner

@llimllib llimllib commented Apr 8, 2026

Summary

  • The filesNeedingLog filter introduced with --changed-only (feat: add --changed-only/-c flag #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.

Test plan

  • go test ./... passes
  • TestUnmodifiedFileGetsGitInfo fails on the old code (verified by simulating the buggy filter)
  • git ls in this repo shows commit messages again

… was added

The filesNeedingLog filter introduced with --changed-only skipped files
with empty status (clean/unmodified files). For an empty string,
strings.SplitSeq yields "", the len > 0 guard never fires, allNew stays
true, and the file is excluded from git log — so no hash/author/message.

Fix: add an explicit check for empty status (unmodified tracked file)
and include those files in filesNeedingLog.

Also adds TestUnmodifiedFileGetsGitInfo, an integration test that would
have caught this regression.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@llimllib llimllib merged commit d84ca28 into main Apr 8, 2026
1 check passed
@llimllib llimllib deleted the fix-unmodified-files-git-info branch April 8, 2026 11:34
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