{"thread":{"id":"40704","subject":"Git potential bug with fork-point","startedAt":"2015-11-02T06:27:52Z","lastAt":"2015-11-07T16:01:20Z","messageCount":2,"participants":["Stenberg Jim (2)","John Keeping"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"272721","messageId":"a3db24afbc3247c3a8466c8d7ce0c785@SEGOTNC5113-N2.vcn.ds.volvo.net","threadId":"40704","inReplyTo":null,"subject":"Git potential bug with fork-point","fromName":"Stenberg Jim (2)","fromEmail":"jim.stenberg.2@volvo.com","sentAt":"2015-11-02T06:27:52Z","receivedAt":"2015-11-02T06:27:52Z","isPatch":false,"sender":{"key":"jim.stenberg.2@volvo.com","avatar":null},"body":"Hello,\nmy name is Jim Stenberg and I'm a developer, albeit not that experienced with Git.\nPlease note that I'm not a native English speaker.\nIf there is anything unclear or lacking, feel free to ask me on this email address.\n\nMy problem:\n\"Git merge-base --fork-point\" acts unexpected when I refer to remote branches (typically \"origin/\".)\nWith unexpected I mean that if I swap the position of the two references that the function takes as argument I get different results.\nI highly suspect that this isn't a feature but a bug, or maybe I'm using the function in a way it wasn't intended to be used.\nI don't need you to fix it (swapping the arguments solves it), I just want you to be aware of it.\n\nHistory & procedure:\nWhen  I was working on my automatic build script I came across the oddity that \"Git merge-base --fork-point\" behaved\ndifferently depending on the order in which the two references are passed.\nI tried to strip the problem down to the smallest example I could. Such example uses:\n. A local folder as repository, initialized by \"git init --bare\"\n. A local clone, acquired by \"git clone ../my/path/to/repo repoName\"\n. Populated with a few files and commits.\nI first detected the problem on git version 1.9.5.msysgit.0 but could confirm the same behavior on git version 2.6.2.windows.1.\nI've pasted a log in text form below, the message did not allow for appended images. The log should be sufficient to reproduce the problem.\nPlease observer the additional new-lines in the log and that no errors or fault messages are presented.\n\nSystem configuration:\nOS Name:                           Microsoft Windows 7 Enterprise\nOS Version:                        6.1.7601 Service Pack 1 Build 7601\nOS Manufacturer:                   Microsoft Corporation\nOS Configuration:                  Member Workstation\nOS Build Type:                     Multiprocessor Free\nSystem Type:                       x64-based PC\nTotal Physical Memory:             3 977 MB\nAvailable Physical Memory:         841 MB\n\nLog:\nC:\\Test\\Local\\Main>git version\ngit version 2.6.2.windows.1\n\nC:\\Test\\Local\\Main>git plot\n* a17df67 (HEAD -> release/15.F, origin/release/15.F) try try again\n* 2af2f42 Other solution to fork-point problem, change position of arguments\n* 8bb3a5e more bugfixing, in release branch is now also checked against server\n* 9db0a3c bugfix, fork-point do not work with origin/* => use only merge-base\n* 6489785 Check on origin/release/* instead of release/*\n* 12cd1af X -> T\n* 2dde79c P -> X && 15.D -> 15.F\n* ffefe54 15.F -> 15.D\n* 634e81d T->P\n* f4003e5 Overhauled the ECU split solution\n* 0e1bc85 reverting even more\n* c0e1391 incorrectly changed to X release\n* faaa7e8 changed to P release\n* 51d5588 Finishing touch, + fault codes\n* c03f0b4 canges, ready for release?\n* 09a7ed6 (origin/master, master) minor bug fixing\n* 4bdb033 (tag: 15.D) Added required files\n\nC:\\Test\\Local\\Main>git merge-base --fork-point release/15.F master\n09a7ed6294ae18fb6087ca1ee020d544f4efe28d\n\nC:\\Test\\Local\\Main>git merge-base --fork-point master release/15.F\n09a7ed6294ae18fb6087ca1ee020d544f4efe28d\n\nC:\\Test\\Local\\Main>git merge-base --fork-point master origin/release/15.F\n09a7ed6294ae18fb6087ca1ee020d544f4efe28d\n\nC:\\Test\\Local\\Main>git merge-base --fork-point origin/master origin/release/15.F\n\n09a7ed6294ae18fb6087ca1ee020d544f4efe28d\n\nC:\\Test\\Local\\Main>git merge-base --fork-point origin/release/15.F origin/master\n\n\nC:\\Test\\Local\\Main>git merge-base --fork-point origin/release/15.F master\n\nC:\\Test\\Local\\Main>\n\nLiterature index:\nWhen reading https://git-scm.com/docs/git-merge-base I didn't found any information about this particular case.\nI didn't find any list of known bugs, hence I can't confirm if it's reported or not.\n\n_________________________________________________\nMed Vänliga Hälsningar / Best Regards\nJim Stenberg M.Sc.\nECU node owner\n\nVolvo Bus Corporation\nDept CD74230, ARAK3\nSE-405 08 Göteborg, Sweden\nPhone: +46 31 32 25173\nEmail: jim.stenberg.2@volvo.com\n"},{"id":"273049","messageId":"20151107160120.GG19802@serenity.lan","threadId":"40704","inReplyTo":"a3db24afbc3247c3a8466c8d7ce0c785@SEGOTNC5113-N2.vcn.ds.volvo.net","subject":"Re: Git potential bug with fork-point","fromName":"John Keeping","fromEmail":"john@keeping.me.uk","sentAt":"2015-11-07T16:01:20Z","receivedAt":"2015-11-07T16:01:20Z","isPatch":false,"sender":{"key":"john@keeping.me.uk","avatar":"https://avatars.githubusercontent.com/u/1702081?v=4"},"body":"On Mon, Nov 02, 2015 at 06:27:52AM +0000, Stenberg Jim (2) wrote:\n> My problem:\n> \"Git merge-base --fork-point\" acts unexpected when I refer to remote\n> branches (typically \"origin/\".) With unexpected I mean that if I swap\n> the position of the two references that the function takes as argument\n> I get different results.  I highly suspect that this isn't a feature\n> but a bug, or maybe I'm using the function in a way it wasn't intended\n> to be used.\n> I don't need you to fix it (swapping the arguments solves it), I just\n> want you to be aware of it.\n> \n> History & procedure:\n> When  I was working on my automatic build script I came across the\n> oddity that \"Git merge-base --fork-point\" behaved differently\n> depending on the order in which the two references are passed.\n\nI think this is expected.  The documentation for `--fork-point` says:\n\n\tgit merge-base --fork-point <ref> [<commit>]\n\n\tFind the point at which a branch (or any history that leads to\n\t<commit>) forked from another branch (or any reference) <ref>.\n\tThis does not just look for the common ancestor of the two\n\tcommits, but also takes into account the reflog of <ref> to see\n\tif the history leading to <commit> forked from an earlier\n\tincarnation of the branch <ref> (see discussion on this mode\n\tbelow).\n\nClearly the order of the arguments matters because the reflog is only\ninspected for the `<ref>` argument.  Since the reflog is involved this\nalso means that the results are likely to be different between separate\ncopies of the same repository.\n\nI suspect you do not want to be using `--fork-point` in your build\nscript; it is intended to help `git rebase` recover from history being\nrewritten and if you do not need that behaviour you are probably better\noff using the normal `git merge-base <commit> <commit>` mode, which\nshould give consistent results regardless of the order of the commits.\n"}]}