{"thread":{"id":"32201","subject":"commit gone after merge - how to debug?","startedAt":"2012-11-26T13:06:09Z","lastAt":"2012-11-26T17:01:25Z","messageCount":13,"participants":["Igor Lautar","Tomas Carnecky","Matthieu Moy"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"203874","messageId":"CAO1Khk_eugH--wp3s-gr4HTvuRyL=SaWHWtEXCRZ_Ak7+s5U=w@mail.gmail.com","threadId":"32201","inReplyTo":null,"subject":"commit gone after merge - how to debug?","fromName":"Igor Lautar","fromEmail":"igor.lautar@gmail.com","sentAt":"2012-11-26T13:06:09Z","receivedAt":"2012-11-26T13:06:09Z","isPatch":false,"sender":{"key":"igor.lautar@gmail.com","avatar":null},"body":"Hi,\n\nThis looks really weird and I cannot explain why it occurs.\n\nSetup is as follows:\n - origin\n - mirror\n - local clone\n\nReference repository is origin from where builds are done etc.\nParallel to that, we keep a mirror that is synced manually\n(fetch/merge/push).\n\nI do this from my local clone (which is mostly just tracking origin\nand mirror, no local branches).\n\nWhat happened is that after a merge of mirror/master into local\nmaster, a commit (that also exists on origin/master) is lost.\n\nLost as in:\npre-merge:\ngit log <file modified by commit>\n - commit shown in history\ngit merge mirror/master\n - no conflicts\ngit log <file modified by commit>\n - commit NOT shown in file history any more and file does not have this change\n\nDoing git log shows commit as being present in repository history. One\ninteresting point is that one of the parents is previous merge commit\nof same branches.\n\nUnfortunately, I cannot open up repository for public access, but\nwould appreciate any pointers how to debug this.\n\ngit fsck finds some dangling blobs/commits, but no other\nwarnings/errors, I can clone repo just fine, everything seams in\norder.\n\nHow can I debug what the merge is doing?\n\ngit version 1.7.12.1 on mac:\nDarwin 12.2.0 Darwin Kernel Version 12.2.0: Sat Aug 25 00:48:52 PDT\n2012; root:xnu-2050.18.24~1/RELEASE_X86_64 x86_64\n\nRegards,\nIgor\n\nPS. please keep me in CC, I'm not on list\n"},{"id":"203875","messageId":"1353935441-ner-9639@calvin","threadId":"32201","inReplyTo":"CAO1Khk_eugH--wp3s-gr4HTvuRyL=SaWHWtEXCRZ_Ak7+s5U=w@mail.gmail.com","subject":"Re: commit gone after merge - how to debug?","fromName":"Tomas Carnecky","fromEmail":"tomas.carnecky@gmail.com","sentAt":"2012-11-26T13:10:41Z","receivedAt":"2012-11-26T13:10:41Z","isPatch":false,"sender":{"key":"tomas.carnecky@gmail.com","avatar":null},"body":"On Mon, 26 Nov 2012 14:06:09 +0100, Igor Lautar <igor.lautar@gmail.com> wrote:\n> git log <file modified by commit>\n>  - commit NOT shown in file history any more and file does not have this change\n\ndoes `git log --full-history <file modified by commit>` show the commit?\n"},{"id":"203879","messageId":"vpqr4ngsdjl.fsf@grenoble-inp.fr","threadId":"32201","inReplyTo":"1353935441-ner-9639@calvin","subject":"Re: commit gone after merge - how to debug?","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2012-11-26T13:23:58Z","receivedAt":"2012-11-26T13:23:58Z","isPatch":false,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Tomas Carnecky <tomas.carnecky@gmail.com> writes:\n\n> On Mon, 26 Nov 2012 14:06:09 +0100, Igor Lautar <igor.lautar@gmail.com> wrote:\n>> git log <file modified by commit>\n>>  - commit NOT shown in file history any more and file does not have this change\n>\n> does `git log --full-history <file modified by commit>` show the commit?\n\nThe other related question being: does reading the section \"History\nSimplification\" in \"man git-log\" help? ;-)\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"203880","messageId":"CAO1Khk_r5eubm6M815FCxXLRpm-zPhzfFasug497saev8o-qeQ@mail.gmail.com","threadId":"32201","inReplyTo":"1353935441-ner-9639@calvin","subject":"Re: commit gone after merge - how to debug?","fromName":"Igor Lautar","fromEmail":"igor.lautar@gmail.com","sentAt":"2012-11-26T13:24:53Z","receivedAt":"2012-11-26T13:24:53Z","isPatch":false,"sender":{"key":"igor.lautar@gmail.com","avatar":null},"body":"On Mon, Nov 26, 2012 at 2:10 PM, Tomas Carnecky\n<tomas.carnecky@gmail.com> wrote:\n> On Mon, 26 Nov 2012 14:06:09 +0100, Igor Lautar <igor.lautar@gmail.com> wrote:\n>> git log <file modified by commit>\n>>  - commit NOT shown in file history any more and file does not have this change\n>\n> does `git log --full-history <file modified by commit>` show the commit?\n\nIndeed it does.\n\nDid the merge with verbosity set to 5. It says the commit I'm merging\nin is virtual (probably as it is a merge commit in itself?).\n\nWhy would commit be left behind after merge? What kind of history\ntriggers this scenario?\nJust trying to understand reasoning as its counter-intuitive to what I\nknow now. This may affect our workflow (ie., change it so we avoid it\nhappening).\n"},{"id":"203881","messageId":"CAO1Khk9mzJjnysnc1iDFeMgqnRq0z35t0kgC-8nrsjJ-oOvdOg@mail.gmail.com","threadId":"32201","inReplyTo":"vpqr4ngsdjl.fsf@grenoble-inp.fr","subject":"Re: commit gone after merge - how to debug?","fromName":"Igor Lautar","fromEmail":"igor.lautar@gmail.com","sentAt":"2012-11-26T13:29:19Z","receivedAt":"2012-11-26T13:29:19Z","isPatch":false,"sender":{"key":"igor.lautar@gmail.com","avatar":null},"body":"On Mon, Nov 26, 2012 at 2:23 PM, Matthieu Moy\n<Matthieu.Moy@grenoble-inp.fr> wrote:\n> The other related question being: does reading the section \"History\n> Simplification\" in \"man git-log\" help? ;-)\n\nSomewhat, but it does not explain why the file no longer has that\nchange. I can understand omitting history if end result is the same,\nbut here it shouldn't be - I cannot find a commit that reversed that\nchange, so the change should still be in after the merge?\n\nThe file in question was not modified on mirror, nor was modified on\norigin after that change.\n"},{"id":"203882","messageId":"vpqehjgscv3.fsf@grenoble-inp.fr","threadId":"32201","inReplyTo":"CAO1Khk9mzJjnysnc1iDFeMgqnRq0z35t0kgC-8nrsjJ-oOvdOg@mail.gmail.com","subject":"Re: commit gone after merge - how to debug?","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2012-11-26T13:38:40Z","receivedAt":"2012-11-26T13:38:40Z","isPatch":false,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Igor Lautar <igor.lautar@gmail.com> writes:\n\n> On Mon, Nov 26, 2012 at 2:23 PM, Matthieu Moy\n> <Matthieu.Moy@grenoble-inp.fr> wrote:\n>> The other related question being: does reading the section \"History\n>> Simplification\" in \"man git-log\" help? ;-)\n>\n> Somewhat, but it does not explain why the file no longer has that\n> change.\n\nIt still has, but it's not shown by \"git log <file>\", probably because\none of the parent of the merge commit introduces no change for this\nfile, so one side of the merge is not needed to explain you how you went\nfrom the origin of time to the last commit.\n\nTry this:\n\ncommit=<sha1 of your merge commit>\n# Show diff with first parent:\ngit diff \"$commit\" \"$commit\"^1\n# Show diff with second parent:\ngit diff \"$commit\" \"$commit\"^2\n\n> I can understand omitting history if end result is the same, but here\n> it shouldn't be - I cannot find a commit that reversed that change, so\n> the change should still be in after the merge?\n\nrevert is not the only situation that can lead to history\nsimplification. I'm no expert in the domain, but I think if you did the\nsame change in two branches, the merge will be candidate for history\nsimplification.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"203883","messageId":"CAO1Khk8=nrKknfqY-k6XaGPDbLrHyrK-8fxfB7XXUWeB7L4EUA@mail.gmail.com","threadId":"32201","inReplyTo":"vpqehjgscv3.fsf@grenoble-inp.fr","subject":"Re: commit gone after merge - how to debug?","fromName":"Igor Lautar","fromEmail":"igor.lautar@gmail.com","sentAt":"2012-11-26T13:58:38Z","receivedAt":"2012-11-26T13:58:38Z","isPatch":false,"sender":{"key":"igor.lautar@gmail.com","avatar":null},"body":"On Mon, Nov 26, 2012 at 2:38 PM, Matthieu Moy\n<Matthieu.Moy@grenoble-inp.fr> wrote:\n> Igor Lautar <igor.lautar@gmail.com> writes:\n>> Somewhat, but it does not explain why the file no longer has that\n>> change.\n>\n> It still has, but it's not shown by \"git log <file>\", probably because\n> one of the parent of the merge commit introduces no change for this\n> file, so one side of the merge is not needed to explain you how you went\n> from the origin of time to the last commit.\n\nNo, the change is not there. See below.\n\n> Try this:\n>\n> commit=<sha1 of your merge commit>\n> # Show diff with first parent:\n> git diff \"$commit\" \"$commit\"^1\n> # Show diff with second parent:\n> git diff \"$commit\" \"$commit\"^2\n\nYes, change is shown in commit^2, but actual file after merge does not have it.\n\nI've double and triple checked, it is just not there. In the end, I've\ncherry-picked the same commit after the merge and change is applied.\nIf change would be there after the merge, cherry-pick would not have\nanything to do (whole commit is a one line change in single file).\n\nSo its not that the history is hidden, the change *is* missing after the merge.\n\nIs there anything else I can try to figure out why its missing (other\nthan actually debugging git code/scripts)? Like debug output for each\nchange being considered/merged in?\n\nRegards,\nIgor\n"},{"id":"203884","messageId":"vpqhaocqx4k.fsf@grenoble-inp.fr","threadId":"32201","inReplyTo":"CAO1Khk8=nrKknfqY-k6XaGPDbLrHyrK-8fxfB7XXUWeB7L4EUA@mail.gmail.com","subject":"Re: commit gone after merge - how to debug?","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2012-11-26T14:03:55Z","receivedAt":"2012-11-26T14:03:55Z","isPatch":false,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Igor Lautar <igor.lautar@gmail.com> writes:\n\n> Yes, change is shown in commit^2, but actual file after merge does not have it.\n\nYour initial message was about the output of \"git log\". Do you mean that\nthe file, on the filesystem, does not have the line introduced by the\ncommit?\n\nIf so, check the content registered in the repository too:\n\ngit show <merge-commit>:<file-name>\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"203887","messageId":"CAO1Khk9Y_SC8q4iHnv848Z+dXMaeUOWxzW76yPSj_as317_u5g@mail.gmail.com","threadId":"32201","inReplyTo":"vpqhaocqx4k.fsf@grenoble-inp.fr","subject":"Re: commit gone after merge - how to debug?","fromName":"Igor Lautar","fromEmail":"igor.lautar@gmail.com","sentAt":"2012-11-26T14:15:35Z","receivedAt":"2012-11-26T14:15:35Z","isPatch":false,"sender":{"key":"igor.lautar@gmail.com","avatar":null},"body":"On Mon, Nov 26, 2012 at 3:03 PM, Matthieu Moy\n<Matthieu.Moy@grenoble-inp.fr> wrote:\n> Your initial message was about the output of \"git log\". Do you mean that\n> the file, on the filesystem, does not have the line introduced by the\n> commit?\n\nYes, sorry if I was not clear enough.\n\n> If so, check the content registered in the repository too:\n>\n> git show <merge-commit>:<file-name>\n\nContent shown is identical to the one in working copy, ie., it is\nmissing one line change.\n\ngit annotate <file> <merge commit>\n - shows that particular line as if it has originated from when the\nfile was originally added to repo.\ngit annotate <file> <merge commit>^2\n - shows line as being modified by a commit done after file was added\n- ie., state I would expect after a merge\n"},{"id":"203888","messageId":"vpqboekqwei.fsf@grenoble-inp.fr","threadId":"32201","inReplyTo":"CAO1Khk9Y_SC8q4iHnv848Z+dXMaeUOWxzW76yPSj_as317_u5g@mail.gmail.com","subject":"Re: commit gone after merge - how to debug?","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2012-11-26T14:19:33Z","receivedAt":"2012-11-26T14:19:33Z","isPatch":false,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Igor Lautar <igor.lautar@gmail.com> writes:\n\n> git annotate <file> <merge commit>^2\n>  - shows line as being modified by a commit done after file was added\n> - ie., state I would expect after a merge\n\nWhat about \"git annotate <file> <merge-commit>^1\"?\n\nWas the merge completely automatic, or were there any conflict?\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"203889","messageId":"CAO1Khk_Czr9=1pECpFAkqfGaYz7qPSE1jvEtQ3u2HOASq+yMwQ@mail.gmail.com","threadId":"32201","inReplyTo":"vpqboekqwei.fsf@grenoble-inp.fr","subject":"Re: commit gone after merge - how to debug?","fromName":"Igor Lautar","fromEmail":"igor.lautar@gmail.com","sentAt":"2012-11-26T14:23:56Z","receivedAt":"2012-11-26T14:23:56Z","isPatch":false,"sender":{"key":"igor.lautar@gmail.com","avatar":null},"body":"On Mon, Nov 26, 2012 at 3:19 PM, Matthieu Moy\n<Matthieu.Moy@grenoble-inp.fr> wrote:\n> What about \"git annotate <file> <merge-commit>^1\"?\n\nNo change, line version goes back to when file was added.\n\n> Was the merge completely automatic, or were there any conflict?\n\nNo conflicts at all. In fact, that particular file was not touched by\none side of merge, only by another. It seems like git ignored the\nchange, but still recorded history (shown only with --full-history).\n"},{"id":"203890","messageId":"vpqa9u4pgew.fsf@grenoble-inp.fr","threadId":"32201","inReplyTo":"CAO1Khk8=nrKknfqY-k6XaGPDbLrHyrK-8fxfB7XXUWeB7L4EUA@mail.gmail.com","subject":"Re: commit gone after merge - how to debug?","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2012-11-26T14:50:15Z","receivedAt":"2012-11-26T14:50:15Z","isPatch":false,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"[ Jumping back in time ]\n\nIgor Lautar <igor.lautar@gmail.com> writes:\n\n>> Try this:\n>>\n>> commit=<sha1 of your merge commit>\n>> # Show diff with first parent:\n>> git diff \"$commit\" \"$commit\"^1\n>> # Show diff with second parent:\n>> git diff \"$commit\" \"$commit\"^2\n>\n> Yes, change is shown in commit^2, but actual file after merge does not have it.\n\nMy commands had the wrong order. It should have been git diff\n\"$commit\"^2 \"$commit\". So, it showed the reverse of the modification\nintroduced by the commit. If you see your change here, it means the\nchange was reverted by the merge.\n\nMy understanding of the situation up to now is:\n\nM\n|\\\nA C\n|/\nB\n\n($commit = M, $commit^1 = A and $commit^2 = B)\n\nYour file had a content (say, \"old\") at revision B. It changed content\n(say, to \"new\") at revision C, and at some point. A did not change it so\nit had the content \"old\". Then you merged, expected the merge commit M\nto get content \"new\", and actually got \"old\".\n\nSo, your history looks like:\n\nM (old)\n| \\\n|  `---.\n|       \\\nA (old)  C (new)\n|       /\n|  .---'\n| /\n|/\nB (old)\n\nand \"git diff C M\" shows the diff between new and old.\n\nSomething went wrong during the merge, I guess it used an ancestor (B\nabove) that had \"new\" as content. I don't see how this happened (rather\nclearly, your history is more complex than my example above), but\n\"GIT_MERGE_VERBOSITY=5 git merge\" will show you which common ancestor\nwas used, it may help.\n\nWhat's possible is that someone had already merged the branch containing\n\"new\", got conflicts, and resolved it in favor of \"old\" somewhere in the\nhistory of your master branch.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"203901","messageId":"CAO1Khk9oNoCpAmWaEfew1K976B+8bn+R6XMi3vGtH-Vj3TJMqg@mail.gmail.com","threadId":"32201","inReplyTo":"vpqa9u4pgew.fsf@grenoble-inp.fr","subject":"Re: commit gone after merge - how to debug?","fromName":"Igor Lautar","fromEmail":"igor.lautar@gmail.com","sentAt":"2012-11-26T17:01:25Z","receivedAt":"2012-11-26T17:01:25Z","isPatch":false,"sender":{"key":"igor.lautar@gmail.com","avatar":null},"body":"On Mon, Nov 26, 2012 at 3:50 PM, Matthieu Moy\n<Matthieu.Moy@grenoble-inp.fr> wrote:\n> What's possible is that someone had already merged the branch containing\n> \"new\", got conflicts, and resolved it in favor of \"old\" somewhere in the\n> history of your master branch.\n\nThis is exactly what happened. I've actually found a merge of origin\nto mirror which reversed the change some time back and was\nsubsequently merged back to origin later on. Most probably human error\nduring merge.\n\nInterestingly, this was my first thought as well, but I've must have\noverlooked that particular merge the first time.\n\nAnyhow, it sorted now, many thanks for your help,\nIgor\n"}]}