Fix working tree state after local codeflow operations#5433
Fix working tree state after local codeflow operations#5433premun merged 6 commits intodotnet:mainfrom
Conversation
| catch (PatchApplicationLeftConflictsException e) | ||
| { | ||
| // We need to make sure that working tree matches the staged changes | ||
| await targetRepo.ExecuteGitCommand(["clean", "-xfd"], cancellationToken: cancellationToken); |
There was a problem hiding this comment.
What exactly is this expecting to clean? Untracked changes that were on the user's environment? Or untracked changes created by the codeflow?
There was a problem hiding this comment.
When you have a file that ends up being removed, it will be removed in index but untracked in working tree. So we need to get rid of it this way.
| foreach (var file in dirtyFiles) | ||
| { | ||
| cancellationToken.ThrowIfCancellationRequested(); | ||
| await targetRepo.CheckoutAsync(file); |
There was a problem hiding this comment.
Am I missing something? I don't see an overload of CheckoutAsync that takes just a file path.
Why are we expecting uncommitted (or unindexed) changes in files after codeflow?
There was a problem hiding this comment.
I don't see an overload of CheckoutAsync that takes just a file path.
The API is probably named wrong because you can also supply a path and it checks it out from the index.
Why are we expecting uncommitted (or unindexed) changes in files after codeflow?
Same reason as above.
I was adding a test verifying the reverts while using the rebase codeflow operations and found some small problems.
In same direction local flows with conflicts, the working tree was not reset based on index so it didn't have the file updates.
#5362