You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature] Add a follow option to git_log so file history continues past renames #2575
Add a follow option to git_log so the history of a file continues past renames (git log --follow -- <file>).
Use Case
A common agent question is "why does this file look like this, and when did it change?". When the file was moved or renamed at some point, git_log with file stops at the rename commit, so the model sees a short history that starts with "move X to Y" and concludes the file is newer than it is. Today the only way around it is to fall back to execute_bash with git log --follow, which needs approval in normal mode and gives unstructured output.
Proposed Solution
New boolean follow parameter on git_log, only meaningful with file.
When follow is true and file is set, getCommits adds --follow before the -- separator.
When follow is set without file, return a short error rather than silently ignoring it.
Optionally default follow to true when file is given, since that is almost always what is wanted; git only supports --follow for a single path, which matches the tool's file argument.
Alternatives Considered
Always passing --follow with file and no new parameter. Simpler for the model, but it can be slow on very large histories and changes existing behaviour, so an explicit option (or a default that can be turned off) is safer.
Asking the model to use execute_bash. Works, but loses the structured output and read-only approval of git_log.
Additional Context
I have searched existing issues to ensure this is not a duplicate
This feature aligns with the project's goals (local-first AI assistance)
Implementation Notes (optional)
The change is in getCommits (source/tools/git/utils.ts), the git_log input schema and its formatter, plus a spec that renames a file in a temp repo and checks both commits are listed.
Activity