Re: A rebase regression in Git 2.18.0
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Aug 28, 2018, 13:33 UTC
- Message-ID
- <nycvar.QRO.7.76.6.1808281532220.16620@tvgsbejvaqbjf.bet>
- In-Reply-To
- <87in3ueiks.fsf@evledraar.gmail.com>
Hi,
On Tue, 28 Aug 2018, Ævar Arnfjörð Bjarmason wrote:
Show 80 quoted lines
> On Tue, Aug 28 2018, Nikolay Kasyanov wrote:
>
> > I’ve found something that may be a regression in git rebase implementation in 2.18.0.
> > First I spotted it on macOS but I can also confirm it happening on Linux.
> > Git 2.19.0.rc0.48.gb9dfa238d is affected too.
> >
> > In order to trigger it, a repo layout similar to the following is required:
> >
> > files/
> > file1
> > file2
> > file3
> > file4
> > file5
> > project
> >
> > Let’s call this state baseline. Then, in a branch, let’s edit project file and move file3 to nested/files subdirectory, here’s the final layout:
> >
> > files/
> > file1
> > file2
> > file4
> > file5
> > nested/
> > files/
> > file3
> > project
> >
> > Let’s get back to master and also edit project file to cause a conflict. After that trying to rebase the branch upon master will cause the following git status output:
> >
> > rebase in progress; onto baf8d2a
> > You are currently rebasing branch 'branch' on 'baf8d2a'.
> > (fix conflicts and then run "git rebase --continue")
> > (use "git rebase --skip" to skip this patch)
> > (use "git rebase --abort" to check out the original branch)
> >
> > Changes to be committed:
> > (use "git reset HEAD <file>..." to unstage)
> >
> > renamed: files/file1 -> nested/files/file1
> > renamed: files/file2 -> nested/files/file2
> > renamed: files/file3 -> nested/files/file3
> > renamed: files/file4 -> nested/files/file4
> > renamed: files/file5 -> nested/files/file5
> >
> > Unmerged paths:
> > (use "git reset HEAD <file>..." to unstage)
> > (use "git add <file>..." to mark resolution)
> >
> > both modified: project
> >
> > All renames except file3 are invalid and shouldn’t be here.
> > Here’s how the output looks like produced by an older Git version (git version 2.15.1):
> >
> > rebase in progress; onto baf8d2a
> > You are currently rebasing branch 'branch' on 'baf8d2a'.
> > (fix conflicts and then run "git rebase --continue")
> > (use "git rebase --skip" to skip this patch)
> > (use "git rebase --abort" to check out the original branch)
> >
> > Changes to be committed:
> > (use "git reset HEAD <file>..." to unstage)
> >
> > renamed: files/file3 -> nested/files/file3
> >
> > Unmerged paths:
> > (use "git reset HEAD <file>..." to unstage)
> > (use "git add <file>..." to mark resolution)
> >
> > both modified: project
> >
> > Here’s a ready-to-use repository: https://github.com/nikolaykasyanov/git-rebase-bug.
>
> Thanks for the test case. This bisects down to 9c0743fe1e
> ("merge-recursive: apply necessary modifications for directory renames",
> 2018-04-19) first released as part of 2.18.0.
>
> I have not dug to see if the behavior change is desired or not, that
> commit changed the results of a bunch of test cases, maybe it was
> intended. Elijah?I think this was already mentioned before, in a different mail thread: have you tried whether `git rebase -m` fixes that behavior?
Ciao, Johannes