All of lore.kernel.org
 help / color / mirror / Atom feed
From: ydirson@free.fr
To: Elijah Newren <newren@gmail.com>
Cc: git <git@vger.kernel.org>
Subject: Re: [BUG] submodule move badly handled by git-rebase
Date: Wed, 8 Apr 2020 09:52:59 +0200 (CEST)	[thread overview]
Message-ID: <1540391834.807942587.1586332379241.JavaMail.root@zimbra39-e7> (raw)
In-Reply-To: <CABPp-BEHQUzRjddKrC7Q7j+2W-W9ZjdVnXVjsM6wVWrpDF7cwQ@mail.gmail.com>

Hi Elijah,

> Hi Yann,
> 
> On Tue, Apr 7, 2020 at 9:36 AM <ydirson@free.fr> wrote:
> >
> > Hello all,
> >
> > When rebasing commits involving move of a submodule, git-rebase
> > fails to
> > record in index the "add" part of the rename.  This leaves the
> > workdir
> > dirty and the rebase gets stopped.
> >
> > fast-export of a testcase is attached.  To reproduce, just
> > "git rebase -i", add a "break" before the move commit,
> > use this to introduce some noise, and watch.
> >
> > Best regards,
> > --
> > Yann
> >
> >
> > (master)$ git rebase -i HEAD^^
> > hint: Waiting for your editor to close the file... Waiting for
> > Emacs...
> > Stopped at b0e1b00... add submodule
> >
> > (master|REBASE 2/3)$ echo >>README
> >
> > (master|REBASE 2/3)$ git commit -a -m noise
> > [detached HEAD d67c886] noise
> >  1 file changed, 1 insertion(+)
> >
> > (master|REBASE 2/3)$ git rebase --continue
> > Adding as subdir/gitlab-oe~08e230f... move submodule instead
> > error: could not apply 08e230f... move submodule
> > Resolve all conflicts manually, mark them as resolved with
> > "git add/rm <conflicted_files>", then run "git rebase --continue".
> > You can instead skip this commit: run "git rebase --skip".
> > To abort and get back to the state before "git rebase", run "git
> > rebase --abort".
> > Could not apply 08e230f... move submodule
> >
> > (master|REBASE 3/3)$ git st
> > interactive rebase in progress; onto c21ef8e
> > Last commands done (3 commands done):
> >    break
> >    pick 08e230f move submodule
> >   (see more in file .git/rebase-merge/done)
> > No commands remaining.
> > You are currently rebasing branch 'master' on 'c21ef8e'.
> >   (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 restore --staged <file>..." to unstage)
> >         modified:   .gitmodules
> >         deleted:    gitlab-oe
> >
> > Unmerged paths:
> >   (use "git restore --staged <file>..." to unstage)
> >   (use "git add <file>..." to mark resolution)
> >         added by them:   subdir/gitlab-oe
> >
> > (master|REBASE 3/3)$
> 
> I couldn't figure out how to duplicate.  Maybe I did something wrong,
> but it was:
>     # download your fast-export stream
>     git init temp
>     cd temp
>     cat ~/Downloads/submodule-move.fexp | git fast-import --quiet
>     git checkout master
>     git rebase -i HEAD^^
>     # Insert a line with just 'b' between the two pick lines; save
>     and
> exit and when it breaks:
>     echo >>README
>     git commit -a -m noise
>     git rebase --continue
> 
> After the rebase --continue, the rebase completes just fine applying
> the patch with the submodule move.  git range-diff master@{1}... will
> show that I inserted a new commit in the middle.  git log --raw looks
> good, showing all four commits including the moved submodule at the
> end.

You're right, I missed crucial point: no problem appears unless the submodule
is initialized.  After checking out the master branch (and possibly issuing
"git reset --hard" to make sure everything is clean), it is necessary to
run "git submodule update --init".


> What git version did you use?  Do you need special settings (what's
> in
> your ~/.gitconfig and your .git/config)?

This is 2.26.0, but like my other report I had it with 2.25.1 already.
Just tested with an clear config (HOME and GIT_CONFIG_NOSYSTEM set) and
the problem triggers as well.

Best regards,
-- 
Yann


  reply	other threads:[~2020-04-08  7:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <702823257.805273759.1586276452976.JavaMail.root@zimbra39-e7>
2020-04-07 16:34 ` [BUG] submodule move badly handled by git-rebase ydirson
2020-04-07 20:49   ` Elijah Newren
2020-04-08  7:52     ` ydirson [this message]
2020-04-08 16:21       ` Elijah Newren
2020-04-08 16:23       ` ydirson
2020-04-08 16:33         ` Elijah Newren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1540391834.807942587.1586332379241.JavaMail.root@zimbra39-e7 \
    --to=ydirson@free.fr \
    --cc=git@vger.kernel.org \
    --cc=newren@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.