Hi Phillip,
The expected behavior: (as per v2.21.0:/git-legacy-rebase.sh:679)
AUTOSTASH=$(git stash create autostash)
git reset --hard
git checkout master
git rebase upstream
git stash apply $AUTOSTASH
The actual behavior:
AUTOSTASH=$(git stash create autostash)
git reset --hard master
git checkout master
git rebase upstream
git stash apply $AUTOSTASH
So, the problem with the actual behavior is the move of the currently active
branch with 'git reset --hard master'
Best regards,
Ben...
On 19-08-2019 11:26, Phillip Wood wrote:
> Hi Ben
>
> On 18/08/2019 10:53, Ben Wijen wrote:
>> I found an issue with git rebase --autostash <upstream> <branch> with an
>> dirty worktree/index.
>> It seems the currently active branch is moved, which is not correct.
>
> I'm not sure I understand what you mean by "the currently active branch is
> moved". 'git rebase --autostash <upstream> <branch>' should checkout <branch>
> (presumably stashing any unstaged and uncommitted changes first) and then do
> rebase <upstream> - what's it doing instead?
>
> Best Wishes
>
> Phillip
>
>> The following patches contain both a test and a fix.
>>
>> Ben Wijen (2):
>> t3420: never change upstream branch
>> rebase.c: make sure current branch isn't moved when autostashing
>>
>> builtin/rebase.c | 18 ++++++------------
>> t/t3420-rebase-autostash.sh | 13 +++++++++----
>> 2 files changed, 15 insertions(+), 16 deletions(-)
>>
>