Re: Regression[2.14.3->2.15]: Interactive rebase fails if submodule is modified
- Date: Mon, 6 Nov 2017 10:37:02 -0800
- From: Brandon Williams <bmwill@xxxxxxxxxx>
- Subject: Re: Regression[2.14.3->2.15]: Interactive rebase fails if submodule is modified
On 11/05, Orgad Shaneh wrote:
> On Sat, Nov 4, 2017 at 8:04 PM, Orgad Shaneh <orgads@xxxxxxxxx> wrote:
> > On Fri, Nov 3, 2017 at 6:20 PM, Johannes Schindelin
> > <Johannes.Schindelin@xxxxxx> wrote:
> >> Hi Orgad,
> >> On Fri, 3 Nov 2017, Johannes Schindelin wrote:
> >>> On Thu, 2 Nov 2017, Orgad Shaneh wrote:
> >>> > I can't reproduce this with a minimal example, but it happens in my project.
> >> Whoa, I somehow overlooked the "can't". Sorry.
> >> I inserted a `git diff-files` here, and it printed exactly what I
> >> expected:
> >> ++ git diff-files
> >> :160000 160000 62cab94c8d8cf047bbb60c12def559339300efa4 0000000000000000000000000000000000000000 M sub
> >>> + git rebase -i HEAD^^
> >>> + )
> >>> +'
> >> There must be something else going wrong that we did not replicate here.
> >> Maybe the `error: cannot rebase: You have unstaged changes.` message was
> >> caused not by a change in the submodule? Could you run `git diff-files`
> >> before the rebase?
> > It's the same before and during the rebase:
> > $ git diff-files
> > :160000 160000 c840225a7cf6bb2ec64da9d35d2c29210bc5e5e8
> > 0000000000000000000000000000000000000000 M sub
> >> This does *not* refresh the index, but maybe that is what is going wrong;
> >> you could call `git update-index --refresh` before the rebase and see
> >> whether that works around the issue?
> > Nope.
> > If I run git submodule update, then rebase --continue works fine, so
> > it's definitely somehow caused by the submodule.
> I just checked out v2.15.0.windows.1 and reverted ff6f1f564c - it
> solves the problem. I still have no idea how to minimally reproduce
> (in my project it's easily reproducible) :)
After reading your bug report and the fact that you weren't able to
reproduce it outside of your project I think i figured out what is
happening. Before ff6f1f564c the gitmodules file wasn't being loaded
unless a codepath explicitly wanted to work with submodules. Now they
are being lazy-loaded so if you call into the submodule config subsystem
it'll work without having to have initialized it before. I suspect
that the submodule which is causing the failure has a
"submodule.<name>.ignore" entry in the .gitmodules file or somewhere in
your repositories config (I actually suspect the latter based on the
When rebase calls into the diff machinery to see if there are unstaged
changes it explicitly requests that submodule's be ignored, but this
desired gets overridden by your repository's config, clearing the
ignored flag and making rebase actually pay attention to the fact that
the submodule has changes in it.
I don't have a patch available to for you to test just yet (but I'll
have some time later today to write one up) but could you verify that
(1) you have an ignore entry for the submodule in question in your
config and (2) removing it from your config avoids the failure? If
that's the case then we would be able to put together a reproducible
recipe for this failure.