Boost logo

Boost :

Subject: Re: [boost] [git][multi_index] help merging from develop
From: Bjørn Roald (bjorn_at_[hidden])
Date: 2013-12-24 21:37:07


On 12/24/2013 11:04 PM, Bjørn Roald wrote:
> On 12/24/2013 09:11 PM, Joaquin M Lopez Munoz wrote:
>> Bjørn Roald <bjorn <at> 4roald.org> writes:
>>
>>>
>>> On 12/24/2013 06:17 PM, Bjørn Roald wrote:
>>>> right, see my reply to Peter on this, copy-paste error of mine. Should
>>>> have been.
>>>>
>>>> git reset --hard 3239677c40b6e15d1bb49675cabb077460333538
>>>
>>> OK, I try again.
>>> git reset --hard 802543fd948b5cf41460addf2260693f08cf7f8d
>>
>> Did that, merged from develop, resolved conflicts as theirs (develop's),
>> commited OK but push failed with
>>
>> git.exe push --progress "origin" master:master
>>
>> To https://github.com/boostorg/multi_index.git
>> ! [rejected] master -> master (non-fast-forward)
>> error: failed to push some refs to
>> 'https://github.com/boostorg/multi_index.git'
>> hint: Updates were rejected because the tip of your current branch is
>> behind
>> hint: its remote counterpart. Integrate the remote changes (e.g.
>> hint: 'git pull ...') before pushing again.
>> hint: See the 'Note about fast-forwards' in 'git push --help' for
>> details.
>>
>>
>> git did not exit cleanly (exit code 1) (13510 ms @ 24/12/2013 21:09:27)
>
> It tells you that you try to do a non-trivial merge at the remote
> repository, and refuses to do so without some more assertion from you
> that that is what you want.
>
> git push --force
>
> or
>
> git push -f
>
> should do it, just use gitk or other tool to make sure the master you
> have locally is what you want first.
>
> That should take care of what you desire, But you should then be worried
> the bad merge commit may already be referenced by somebody, and you
> would be subject for some heat if you break canonical boost clone or
> submodule update as your bad commit is not available. That may happen
> if git garbage collection cleans up on the remote and find nothing
> referencing your old commit any longer.
>
> To prevent this you must make sure some git ref on
> https://github.com/boostorg/multi_index/ reference the bad commit.
>
> You may then push your tag for the bad merge commit if you like to.
>
> If you made the tag I suggested, do
> git push --tags
>
> done. In TG i think there is a checkbox for tags in the push dialog.
>
> You can alternatively use a branch with a obvious not to use name for
> this, e.g.
>
> git checkout -b trash/bad-master-merges 3239677c4
> git push
>
> or if you made the tag as I suggested,
>
> git checkout -b trash/bad-master-merges bad-merge
> git push
> git tag -d bad-merge # to remove the tag from local repository
>
> A branch may be simpler to clean up in future if you like to.

Joakim,

I did some tests, and realized I had overlooked an important fact. Your
first merge looks bad as well. Thus simply doing a normal merge after a
reset as I suggested will not do what you want. The merge depend on a
sensible common ancestor, and that is what you need to establish gefore
git can work its merging magic. The conversion provided no such common
ancestor for the old svn trunk and release branches.

I think Peters suggested procedure may be used. It will leave the
failed merges in the history, but they don't make any bad changes to
master, so it is probably no big deal.

If you want try to set a common ancestor in the past,

c564f8f5dd9e8a4520345335382008d96aff7549
     [SVN r85497]

on develop which is identical to

590e3d151181716f05a4daaf7f371cbde04171d7
      merged [85497] from trunk
     [SVN r85509]

on the master branch

Thus they seem to be the prime candidates.

You need to make a branch on one of them, e.g.:

git checkout -b fix-merge 590e3d151181716f05a4daaf7f371cbde04171d7
git merge c564f8f5dd9e8a4520345335382008d96aff7549

you now have a common ancestor commit at the head of local fix-merge
branch, so

git merge --no-ff origin/develop

does what you expect, and the new merge commit in fix-merge is identical
to your develop branch head. This is what you want, I think, only you
want it in the master branch,

So how do we go about with that? Right now it seems like the boost super
project develop branch points at the
fdd4934c234de61f8d2ba22fc3465a0ac90e11c5 commit of the multi_index
submodule, which is the head of multi_index's develop branch, thus there
are little risk involved in moving the master branch head if you like to
do that.

git checkout master
git checkout -b trash/bad-master

git checkout master
git reset --hard fix-merge
git push -f

If you want to ensure the bad commit stays on github server:
git checkout trash/bad-master
git push

cleanup in local repo
git branch -d fix-merge

HTH

--
Bjørn

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk