{"thread":{"id":"59366","subject":"Track git blame through two unrelated histories","startedAt":"2023-03-09T11:11:20Z","lastAt":"2023-03-13T11:50:20Z","messageCount":4,"participants":["Ilia Pozhilov","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"473278","messageId":"CAAo-ADZBBRxSROeAwrA9o30Etf3QQhLCaWQJtVsChVwT-AbgTg@mail.gmail.com","threadId":"59366","inReplyTo":null,"subject":"Track git blame through two unrelated histories","fromName":"Ilia Pozhilov","fromEmail":"ilyapoz@gmail.com","sentAt":"2023-03-09T11:05:07Z","receivedAt":"2023-03-09T11:11:20Z","isPatch":false,"sender":{"key":"ilyapoz@gmail.com","avatar":"https://gravatar.com/avatar/464d01321e67b719036d669fdb497c0d110487c20c0d4f99523eb13964304072?d=mp&s=160"},"body":"Hello!\n\nI have a weird use case. A repository at my company was migrated git\n-> non-git vcs -> git again.\n\nDuring transition to non-git vcs the history was lost, i.e. an initial\ncommit was created from some known commit from the old git repo.\n\nMigration to new git repo was more transparent and we have the whole history.\n\nSo let's say I add two remotes and fetch all the commits, but they\nlook like this:\n\nA->B-> .... . . . -> Z    history1\n\n1 -> 2 -> ..... -> 0 history2\n\nand file contents in commits Z and 1 are exactly the same, but the\ncommits themselves are completely unrelated for git.\n\nWhat I want to achieve is blame working across this boundary.\n\nWhat can I do? It this possible right now? Is it difficult to\nimplement? Is there a good enough workaround? I don't think rewriting\ncommits 1... 0 is an option, but rewriting A ... Z is an option.\n\nWhat do you think?\n"},{"id":"473307","messageId":"xmqqwn3pai2d.fsf@gitster.g","threadId":"59366","inReplyTo":"CAAo-ADZBBRxSROeAwrA9o30Etf3QQhLCaWQJtVsChVwT-AbgTg@mail.gmail.com","subject":"Re: Track git blame through two unrelated histories","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-03-09T18:35:54Z","receivedAt":"2023-03-09T18:36:00Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ilia Pozhilov <ilyapoz@gmail.com> writes:\n\n> So let's say I add two remotes and fetch all the commits, but they\n> look like this:\n>\n> A->B-> .... . . . -> Z    history1\n>\n> 1 -> 2 -> ..... -> 0 history2\n>\n> and file contents in commits Z and 1 are exactly the same, but the\n> commits themselves are completely unrelated for git.\n\nYou mean you want to pretend that history \"2 -> ... -> 0\" was built\non top of Z?  Here I am assuming that time flows from left to right\nin the picture.\n\nIf so, you should be able to graft the histories together, perhaps?\n\nTotally untested but something like \n\n\t$ git replace --graft 1 Z\n\nbased on my reading of \"git help replace\" should allow you to\npretend that Z happened immediately before 1.\n\n"},{"id":"473450","messageId":"CAAo-ADbDW3WCuRFCnNopg31B_hDumz5qVOzirczG70odSVa6Bw@mail.gmail.com","threadId":"59366","inReplyTo":"xmqqwn3pai2d.fsf@gitster.g","subject":"Re: Track git blame through two unrelated histories","fromName":"Ilia Pozhilov","fromEmail":"ilyapoz@gmail.com","sentAt":"2023-03-13T11:48:40Z","receivedAt":"2023-03-13T11:49:37Z","isPatch":false,"sender":{"key":"ilyapoz@gmail.com","avatar":"https://gravatar.com/avatar/464d01321e67b719036d669fdb497c0d110487c20c0d4f99523eb13964304072?d=mp&s=160"},"body":"Track git blame through two unrelated histories\n\nInbox\nIlia Pozhilov\nThu, Mar 9, 1:05 PM (4 days ago)\nHello! I have a weird use case. A repository at my company was\nmigrated git -> non-git vcs -> git again. During transition to non-git\nvcs the history was lost,\n\nJunio C Hamano <gitster@pobox.com>\n\nThu, Mar 9, 8:35 PM (4 days ago)\n\n\nto me, git\nIlia Pozhilov <ilyapoz@gmail.com> writes:\n\n> So let's say I add two remotes and fetch all the commits, but they\n> look like this:\n>\n> A->B-> .... . . . -> Z    history1\n>\n> 1 -> 2 -> ..... -> 0 history2\n>\n> and file contents in commits Z and 1 are exactly the same, but the\n> commits themselves are completely unrelated for git.\n\nYou mean you want to pretend that history \"2 -> ... -> 0\" was built\non top of Z?  Here I am assuming that time flows from left to right\nin the picture.\n\nIf so, you should be able to graft the histories together, perhaps?\n\nTotally untested but something like\n\n        $ git replace --graft 1 Z\n\nbased on my reading of \"git help replace\" should allow you to\npretend that Z happened immediately before 1.\n\n\n\nJunio C Hamano (gitster@pobox.com), git@vger.kernel.org\nPlain text\n\n\n\n\n\n\nIlia Pozhilov <ilyapoz@gmail.com>\n\nFri, Mar 10, 6:32 PM (3 days ago)\n\n\nto Junio\nThank you very much for this! It worked, I found the corresponding\ncommits and did exactly as you suggested. Now blames just work!\n\nNow I will need to figure out if this is push'able to github, but even\nat this stage it's incredibly useful, I love blames!\n\nOn Thu, Mar 9, 2023 at 8:35 PM Junio C Hamano <gitster@pobox.com> wrote:\n>\n> Ilia Pozhilov <ilyapoz@gmail.com> writes:\n>\n> > So let's say I add two remotes and fetch all the commits, but they\n> > look like this:\n> >\n> > A->B-> .... . . . -> Z    history1\n> >\n> > 1 -> 2 -> ..... -> 0 history2\n> >\n> > and file contents in commits Z and 1 are exactly the same, but the\n> > commits themselves are completely unrelated for git.\n>\n> You mean you want to pretend that history \"2 -> ... -> 0\" was built\n> on top of Z?  Here I am assuming that time flows from left to right\n> in the picture.\n>\n> If so, you should be able to graft the histories together, perhaps?\n>\n> Totally untested but something like\n>\n>         $ git replace --graft 1 Z\n>\n> based on my reading of \"git help replace\" should allow you to\n> pretend that Z happened immediately before 1.\n>\n"},{"id":"473451","messageId":"CAAo-ADbUf1UqSE1EFf1yOY5Mhu0R5_NQuK8agBpOn60zgpWnVQ@mail.gmail.com","threadId":"59366","inReplyTo":"xmqqwn3pai2d.fsf@gitster.g","subject":"Re: Track git blame through two unrelated histories","fromName":"Ilia Pozhilov","fromEmail":"ilyapoz@gmail.com","sentAt":"2023-03-13T11:49:23Z","receivedAt":"2023-03-13T11:50:20Z","isPatch":false,"sender":{"key":"ilyapoz@gmail.com","avatar":"https://gravatar.com/avatar/464d01321e67b719036d669fdb497c0d110487c20c0d4f99523eb13964304072?d=mp&s=160"},"body":"Thank you very much for this! It worked, I found the corresponding\ncommits and did exactly as you suggested. Now blames just work!\n\nNow I will need to figure out if this is push'able to github, but even\nat this stage it's incredibly useful, I love blames!\n\nOn Thu, Mar 9, 2023 at 8:35 PM Junio C Hamano <gitster@pobox.com> wrote:\n>\n> Ilia Pozhilov <ilyapoz@gmail.com> writes:\n>\n> > So let's say I add two remotes and fetch all the commits, but they\n> > look like this:\n> >\n> > A->B-> .... . . . -> Z    history1\n> >\n> > 1 -> 2 -> ..... -> 0 history2\n> >\n> > and file contents in commits Z and 1 are exactly the same, but the\n> > commits themselves are completely unrelated for git.\n>\n> You mean you want to pretend that history \"2 -> ... -> 0\" was built\n> on top of Z?  Here I am assuming that time flows from left to right\n> in the picture.\n>\n> If so, you should be able to graft the histories together, perhaps?\n>\n> Totally untested but something like\n>\n>         $ git replace --graft 1 Z\n>\n> based on my reading of \"git help replace\" should allow you to\n> pretend that Z happened immediately before 1.\n>\n"}]}