Repository navigation
Consume a rename's source path when git reports it in the worktree column [patch] - #470
Merged
Merged
Conversation
…lumn [patch] git status --porcelain reports a rename detected in the worktree (an intent-to-add file matched against a deleted tracked file) as " R", with the source path following as a bare entry. ListPendingChanges only checked the index column, so that source was parsed as its own record and the commit prompt listed a file that does not exist. Fixes #437 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01CaZMWc5xm4vDRcyMefDXyV
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01CaZMWc5xm4vDRcyMefDXyV
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.



Fixes #437
What changed
GitCli.ListPendingChangesskipped a rename's trailing source-path entry only when the rename was in the index status column (entry[0]). Git can also report a rename in the worktree column. That happens when a file added withgit add -Nmatches a deleted tracked file, and the record then readsR new.txt\0ab cd.txt\0. The source entryab cd.txtwas parsed as a record of its own, so the commit prompt listed a phantomcd.txtand showed the wrong change count.The check now also looks at
entry[1], and the comment explains both cases.Tests
New
CommitTests.AWorktreeRenameReportsOnlyItsDestination, the issue's repro:ab cd.txt.new.txtwith the same content.git add -N new.txt.The test first asserts that git really reports
R new.txt(so it can't pass by accident), then that onlynew.txtis listed.GitCli.cschange reverted, the new test fails (Assert.AreEqual(1, changes.Count)).GitCliTests.CloningAnLfsRepositoryRestoresTheFileContentRatherThanThePointer. It fails the same way on unchangedmainin this sandbox, where the LFS smudge filter doesn't run on a local clone. It is unrelated to this change.🤖 Generated with Claude Code
https://claude.ai/code/session_01CaZMWc5xm4vDRcyMefDXyV
Generated by Claude Code