git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* If a branch moves a submodule, "merge --ff[-only]" succeeds while "merge --no-ff" fails with conflicts
@ 2016-09-02 19:22 Dakota Hawkins
  2016-09-06 18:40 ` Dakota Hawkins
  2016-09-06 19:00 ` Stefan Beller
  0 siblings, 2 replies; 7+ messages in thread
From: Dakota Hawkins @ 2016-09-02 19:22 UTC (permalink / raw)
  To: Git Mailing List, mwitte

Below is a simple reproduction of the issue.

The _real_ problem is that this is how our pull request merges work,
they're not allowed to do fast-forward merges. To work around this we
are having to split this up into two pull requests/merges: One that
copies the submodules to the new location and includes any fixes
required to support the move, and a second that removes the old
locations.

## Setup steps
git clone https://github.com/dakotahawkins/submodule-move-merge-bug-main-repo.git
cd submodule-move-merge-bug-main-repo
    ## How it was initially constructed
    # git submodule add ../submodule-move-merge-bug-submodule-repo.git
./submodule-location-1
    # git commit -m "Added submodule in its initial location"
    # git push
    # git checkout -b move-submodule
    # git mv ./submodule-location-1 ./submodule-location-2
    # git commit -m "Moved submodule"
    # git push --set-upstream origin move-submodule
git branch move-submodule origin/move-submodule

## Test fast-forward merge, this will work
git checkout -b merge-ff-test master # warning: unable to rmdir
submodule-location-2: Directory not empty
rm -rf ./submodule-location-2
git merge --ff-only move-submodule

## Test no-fast-forward merge, this will fail with conflicts:
git checkout -b merge-no-ff-test master
git merge --no-ff move-submodule
    # Auto-merging submodule-location-2
    # Adding as submodule-location-2~move-submodule instead
    # Automatic merge failed; fix conflicts and then commit the result.
git status
    # On branch merge-no-ff-test
    # You have unmerged paths.
    #   (fix conflicts and run "git commit")
    #   (use "git merge --abort" to abort the merge)
    #
    # Changes to be committed:
    #
    #         modified:   .gitmodules
    #         deleted:    submodule-location-1
    #
    # Unmerged paths:
    #   (use "git add <file>..." to mark resolution)
    #
    #         added by us:     submodule-location-2
    #
    # fatal: Not a git repository: 'submodule-location-1/.git'
    # Submodule changes to be committed:
    #
    # * submodule-location-1 07fec24...0000000:

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-09-10  0:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-02 19:22 If a branch moves a submodule, "merge --ff[-only]" succeeds while "merge --no-ff" fails with conflicts Dakota Hawkins
2016-09-06 18:40 ` Dakota Hawkins
2016-09-06 19:00 ` Stefan Beller
2016-09-06 20:02   ` Dakota Hawkins
2016-09-09 23:37     ` Dakota Hawkins
2016-09-09 23:57       ` Stefan Beller
2016-09-10  0:17         ` Dakota Hawkins

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).