[solved] diverging git commit ids

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
User avatar
ffpp
Engineer
Engineer
Posts: 125
Joined: 29 Jan 2010 12:56

[solved] diverging git commit ids

Post by ffpp »

Hi,

after a long while of not maintaining it I am currently merging my patch into the current master sources from github.
I used to use the old repository url: http://git.openttd.org/openttd/trunk.git

But I realized that I get a redirect to the new repo:

Code: Select all

$ git remote show openttd
fatal: unable to update url base from redirection:
  asked for: http://git.openttd.org/openttd/trunk.git/info/refs?service=git-upload-pack
   redirect: https://github.com/OpenTTD/OpenTTD
I updated the remote and fetched the branch again, but during the merge I realized that I don't have a common merge-base anymore and this creates a million conflicts during the merge. The last merge against the old github url was done against this commit:

Code: Select all

d6df92b6d (openttd/master, openttd) (svn r27969) -Update from Eints: danish: 22 changes by Knogle
The last common commit is:

Code: Select all

$ git merge-base openttd nr/master
a580b4c21ee20179fa50bdab04aaeb586185fe8e
$ git --no-pager log -1 a580b4c21ee20179fa50bdab04aaeb586185fe8e
commit a580b4c21ee20179fa50bdab04aaeb586185fe8e
Author: bjarni <bjarni@openttd.org>
Date:   Mon Nov 29 20:03:04 2004 +0000

    (svn r855) BeOS: moved bemidi to os/beos/ (w-ber)
Then they diverge starting at the next commit:
old repo:

Code: Select all

$ git --no-pager log --oneline openttd | grep 'svn r856)'
4950c36769 (svn r856) Makefile: added the flags CYGWIN and MINGW to libdetection. They were missing in the autodetected makefile.config
new repo:

Code: Select all

$ git --no-pager log --oneline nr/master | grep 'svn r856)'
00d6b3609f (svn r856) Makefile: added the flags CYGWIN and MINGW to libdetection. They were missing in the autodetected makefile.config
Does anybody know what is the reason for this?

I think for my merge I will just cherry-pick all commits for my own patch onto a new branch or something.
Last edited by ffpp on 12 Sep 2018 19:03, edited 1 time in total.
Eddi
Tycoon
Tycoon
Posts: 8267
Joined: 17 Jan 2007 00:14

Re: diverging git commit ids

Post by Eddi »

the way the new primary repo was created differs from the way the old copy repo was created. however, you should be able to use "rebase onto" to convert an old clone to the new repo
User avatar
ffpp
Engineer
Engineer
Posts: 125
Joined: 29 Jan 2010 12:56

Re: diverging git commit ids

Post by ffpp »

I get several conflicts á la

Code: Select all

irst, rewinding head to replay your work on top of it...
Applying: (svn r5214) [languages] Re-done afrikaans change, this time proper
Using index info to reconstruct a base tree...
A	lang/unfinished/afrikaans.txt
Falling back to patching base and 3-way merge...
CONFLICT (modify/delete): lang/unfinished/afrikaans.txt deleted in HEAD and modified in (svn r5214) [languages] Re-done afrikaans change, this time proper. Version (svn r5214) [languages] Re-done afrikaans change, this time proper of lang/unfinished/afrikaans.txt left in tree.
error: Failed to merge in the changes.
Patch failed at 0001 (svn r5214) [languages] Re-done afrikaans change, this time proper
The copy of the patch that failed is found in: .git/rebase-apply/patch

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".
Eddi
Tycoon
Tycoon
Posts: 8267
Joined: 17 Jan 2007 00:14

Re: diverging git commit ids

Post by Eddi »

that sounds like you're trying to merge the entire old repo into the new one (or worse, the other way around), instead of just your changes?

in any case, unfinished/afrikaans.txt doesn't sound like a file containing vital information...
User avatar
JGR
Tycoon
Tycoon
Posts: 2557
Joined: 08 Aug 2005 13:46
Location: Ipswich

Re: diverging git commit ids

Post by JGR »

If doing a rebase you will need to explicitly exclude the old upstream.
Something like (with your branch checked out)

Code: Select all

git rebase --onto nr/master openttd/master
When I had this problem when merging the new upstream into my patchpack/repo, I used git replace to artificially join the two histories together at equivalent commits, which made things much easier.
That may be worth looking into if you get spurious conflicts or other issues trying to rebase or cherry-pick.
Ex TTDPatch Coder
Patch Pack, Github
User avatar
ffpp
Engineer
Engineer
Posts: 125
Joined: 29 Jan 2010 12:56

Re: diverging git commit ids

Post by ffpp »

Eddi wrote:that sounds like you're trying to merge the entire old repo into the new one (or worse, the other way around), instead of just your changes?

in any case, unfinished/afrikaans.txt doesn't sound like a file containing vital information...
I think that the old code base and the new one have diverged long before I made my first commit. So even when I try to rebase only my own changes onto the new master branch, it will use this old commit r5214 as oldest merge-base.
I tried to resolve those conflicts but they more complex than this one with the language text file.
JGR wrote:If doing a rebase you will need to explicitly exclude the old upstream.
Something like (with your branch checked out)
Actually, the rebase worked now with JGR's suggestion. I was not aware of this rebase syntax where you can exclude a branch, the older master in this case.

Thanks for the help!
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 26 guests