Demonstrate and fix a rebase --autostash bug with dirty submodules #56
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.
This bug report came in via Git for Windows (already with version 2.19.0, but I misread the reporter's enthusiasm to take matters into his own hands).
The culprit is, in a nutshell, that the built-in rebase tries to run
git stash
only when the worktree is dirty, but it includes submodules in that. However,git stash
cannot do anything about submodules, and if the only changes are in submodules, then it won't even give us back an OID, and the built-in rebase acts surprised.The solution is easy: simply exclude the submodules from the question whether the worktree is dirty.
What is surprisingly not simple is to get the regression test right. For that reason, and because I firmly believe that it is easier to verify a fix for a regression when the regression test is introduced separately (i.e. making it simple to verify that there is a regression), I really want to keep the first patch separate from the second one.
Since this bug concerns the built-in rebase, I based the patches on top of
next
.