{"thread":{"id":"50946","subject":"Feature request: Allow to update commit ID in messages when rebasing","startedAt":"2019-04-17T20:37:27Z","lastAt":"2019-04-19T19:19:52Z","messageCount":7,"participants":["Giuseppe Crinò","Ævar Arnfjörð Bjarmason","Junio C Hamano","Jakub Narebski","Phil Hord"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"374069","messageId":"CAGV3M54XhRMDXdhbfTon5nRV59VOjw8W4YrNP63TqPYm8pxd8Q@mail.gmail.com","threadId":"50946","inReplyTo":null,"subject":"Feature request: Allow to update commit ID in messages when rebasing","fromName":"Giuseppe Crinò","fromEmail":"giuscri@gmail.com","sentAt":"2019-04-17T20:35:23Z","receivedAt":"2019-04-17T20:37:27Z","isPatch":false,"sender":{"key":"giuscri@gmail.com","avatar":"https://gravatar.com/avatar/0d6b46f6496321ee3646c8712de0b475e225f393a8c72d2c2385d7820b74dd90?d=mp&s=160"},"body":"The feature I'm asking is to add an extra-step during rebasing,\nchecking whether there's a reference to a commit that's not going to\nbe included in history and asks the user whether the heuristics is\ncorrect and if she wants to update those references.\n\nScenario: it can happen for a commit message to contain the ID of an\nancestor commit. A typical example is a commit with the message\n\"revert 01a9fe8\". If 01a9fe8 and the commit that reverts it are\ninvolved in a rebase the message \"revert 01a9fe8\" is no longer valid\n-- the old 01a9fe8 has now a different hash. This will most likely be\nignored by the person who's rebasing but will let the other people\nreading history confused.\n\nGiuseppe\n"},{"id":"374070","messageId":"878sw8bbby.fsf@evledraar.gmail.com","threadId":"50946","inReplyTo":"CAGV3M54XhRMDXdhbfTon5nRV59VOjw8W4YrNP63TqPYm8pxd8Q@mail.gmail.com","subject":"Re: Feature request: Allow to update commit ID in messages when rebasing","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2019-04-17T20:56:01Z","receivedAt":"2019-04-17T20:56:08Z","isPatch":false,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Wed, Apr 17 2019, Giuseppe Crinò wrote:\n\n> The feature I'm asking is to add an extra-step during rebasing,\n> checking whether there's a reference to a commit that's not going to\n> be included in history and asks the user whether the heuristics is\n> correct and if she wants to update those references.\n>\n> Scenario: it can happen for a commit message to contain the ID of an\n> ancestor commit. A typical example is a commit with the message\n> \"revert 01a9fe8\". If 01a9fe8 and the commit that reverts it are\n> involved in a rebase the message \"revert 01a9fe8\" is no longer valid\n> -- the old 01a9fe8 has now a different hash. This will most likely be\n> ignored by the person who's rebasing but will let the other people\n> reading history confused.\n\nThis would be useful. Done properly we'd need some machinery/command to\nextract the commit id parts from the free-text of the commit\nmessage. That would be useful for other parts of git, e.g. as discussed\nhere:\nhttps://public-inbox.org/git/xmqqvaxp9oyp.fsf@gitster.mtv.corp.google.com/\n"},{"id":"374084","messageId":"xmqqtvewgj4c.fsf@gitster-ct.c.googlers.com","threadId":"50946","inReplyTo":"878sw8bbby.fsf@evledraar.gmail.com","subject":"Re: Feature request: Allow to update commit ID in messages when rebasing","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-04-18T02:08:51Z","receivedAt":"2019-04-18T02:08:57Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:\n\n> On Wed, Apr 17 2019, Giuseppe Crinò wrote:\n>\n>> The feature I'm asking is to add an extra-step during rebasing,\n>> checking whether there's a reference to a commit that's not going to\n>> be included in history and asks the user whether the heuristics is\n>> correct and if she wants to update those references.\n>>\n>> Scenario: it can happen for a commit message to contain the ID of an\n>> ancestor commit. A typical example is a commit with the message\n>> \"revert 01a9fe8\". If 01a9fe8 and the commit that reverts it are\n>> involved in a rebase the message \"revert 01a9fe8\" is no longer valid\n>> -- the old 01a9fe8 has now a different hash. This will most likely be\n>> ignored by the person who's rebasing but will let the other people\n>> reading history confused.\n>\n> This would be useful. Done properly we'd need some machinery/command to\n> extract the commit id parts from the free-text of the commit\n> message. That would be useful for other parts of git, e.g. as discussed\n> here:\n> https://public-inbox.org/git/xmqqvaxp9oyp.fsf@gitster.mtv.corp.google.com/\n\nThat's a helpful input.\n\nBut in general we do not have an infrastructure to systematically\nkeep track of \"this commit was rewritten to produce that other\ncommit\", so even if a mention of an old/superseded commit can be\nidentified reliably, there is no reliable source to rewrite it to\nthe name of the corresponding commit in the new world.\n\nFor that mapping, we'd need something like the \"git change/evolve\"\nStefan Xenos was working on, which hasn't materialized.\n\n"},{"id":"374122","messageId":"86o953z0b9.fsf@gmail.com","threadId":"50946","inReplyTo":"xmqqtvewgj4c.fsf@gitster-ct.c.googlers.com","subject":"Re: Feature request: Allow to update commit ID in messages when rebasing","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2019-04-18T17:32:26Z","receivedAt":"2019-04-18T17:32:36Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:\n>> On Wed, Apr 17 2019, Giuseppe Crinò wrote:\n>>\n>>> The feature I'm asking is to add an extra-step during rebasing,\n>>> checking whether there's a reference to a commit that's not going to\n>>> be included in history and asks the user whether the heuristics is\n>>> correct and if she wants to update those references.\n>>>\n>>> Scenario: it can happen for a commit message to contain the ID of an\n>>> ancestor commit. A typical example is a commit with the message\n>>> \"revert 01a9fe8\". If 01a9fe8 and the commit that reverts it are\n>>> involved in a rebase the message \"revert 01a9fe8\" is no longer valid\n>>> -- the old 01a9fe8 has now a different hash. This will most likely be\n>>> ignored by the person who's rebasing but will let the other people\n>>> reading history confused.\n>>\n>> This would be useful. Done properly we'd need some machinery/command to\n>> extract the commit id parts from the free-text of the commit\n>> message. That would be useful for other parts of git, e.g. as discussed\n>> here:\n>> https://public-inbox.org/git/xmqqvaxp9oyp.fsf@gitster.mtv.corp.google.com/\n>\n> That's a helpful input.\n>\n> But in general we do not have an infrastructure to systematically\n> keep track of \"this commit was rewritten to produce that other\n> commit\", so even if a mention of an old/superseded commit can be\n> identified reliably, there is no reliable source to rewrite it to\n> the name of the corresponding commit in the new world.\n>\n> For that mapping, we'd need something like the \"git change/evolve\"\n> Stefan Xenos was working on, which hasn't materialized.\n\nWell, what about limiting changes and rewriting only to the commits\nbeing rewritten by [interactive] rebase?  I mean that we would rewrite\n\"revert 01a9fe8\" only if:\n\na.) the commit with this message is undergoing rewrite\nb.) the commit 01a9fe8 is undergoing rewrite in the same command\n\nWe could use the infrastructure from git-filter-branch for this.\n\nIt is serious limitation, but that might be good enough for Giuseppe\nCrinò use case.  Though for example there is a question what to do if\nreferred-to commit (01a9fe8 in the example) is simply dropped, or is\ngets split in two?  Ask user?\n\n\nAnother possibility would be to provide a command line option to rebase\nwhich would automatically generate replacements (in git-replace meaning)\nfrom old pre-rebase name to new post-rebase name (assuming no splitting,\nno dropping commits).  This would make references just work... well, as\nlong as refs/replace/* are in place (they are not copied by default).\n\nOn the other hand some of our performance-improving features, like the\ncommit-graph, do not work if there are replacements.\n\n\nBest,\n--\nJakub Narębski\n"},{"id":"374126","messageId":"CABURp0r_0pTY9JAsphm-TUBVCarK8h8SmO-v8zf7OPzf+7=SJw@mail.gmail.com","threadId":"50946","inReplyTo":"86o953z0b9.fsf@gmail.com","subject":"Re: Feature request: Allow to update commit ID in messages when rebasing","fromName":"Phil Hord","fromEmail":"phil.hord@gmail.com","sentAt":"2019-04-18T18:00:23Z","receivedAt":"2019-04-18T18:32:06Z","isPatch":false,"sender":{"key":"phil.hord@gmail.com","avatar":"https://avatars.githubusercontent.com/u/123908?v=4"},"body":"Wouldn't we need to extend this to cherry-pick, too?  Suppose I do this:\n\n    $ git log -2 --oneline --decorate foo\n    abcd123456  (foo)   Revert 123456aaaa\n    123456aaaa  Some useful commit for the future, but not now\n\n    $ git checkout bar\n    $ git cherry-pick foo^ foo\n\n    $ git log -2 --oneline --decorate\n    badc0ffee  (bar)   Revert 123456aaaa\n    babeface0  Some useful commit for the future, but not now\n\nNow when I rebase bar, the revert appears to be untwinned.\n\nSimilar problems arise for other history modifying tools like\nfilter-branch, fast-export, reposurgeon, bfg, etc.\n\nI guess we can use 'git patch-id' to see if the companion commit is\nstill in our history, but this seems tenuous.  Can we make it work\nanyway?\n\n\nOn Thu, Apr 18, 2019 at 10:33 AM Jakub Narebski <jnareb@gmail.com> wrote:\n>\n> Junio C Hamano <gitster@pobox.com> writes:\n> > Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:\n> >> On Wed, Apr 17 2019, Giuseppe Crinò wrote:\n> >>\n> >>> The feature I'm asking is to add an extra-step during rebasing,\n> >>> checking whether there's a reference to a commit that's not going to\n> >>> be included in history and asks the user whether the heuristics is\n> >>> correct and if she wants to update those references.\n> >>>\n> >>> Scenario: it can happen for a commit message to contain the ID of an\n> >>> ancestor commit. A typical example is a commit with the message\n> >>> \"revert 01a9fe8\". If 01a9fe8 and the commit that reverts it are\n> >>> involved in a rebase the message \"revert 01a9fe8\" is no longer valid\n> >>> -- the old 01a9fe8 has now a different hash. This will most likely be\n> >>> ignored by the person who's rebasing but will let the other people\n> >>> reading history confused.\n> >>\n> >> This would be useful. Done properly we'd need some machinery/command to\n> >> extract the commit id parts from the free-text of the commit\n> >> message. That would be useful for other parts of git, e.g. as discussed\n> >> here:\n> >> https://public-inbox.org/git/xmqqvaxp9oyp.fsf@gitster.mtv.corp.google.com/\n> >\n> > That's a helpful input.\n> >\n> > But in general we do not have an infrastructure to systematically\n> > keep track of \"this commit was rewritten to produce that other\n> > commit\", so even if a mention of an old/superseded commit can be\n> > identified reliably, there is no reliable source to rewrite it to\n> > the name of the corresponding commit in the new world.\n> >\n> > For that mapping, we'd need something like the \"git change/evolve\"\n> > Stefan Xenos was working on, which hasn't materialized.\n>\n> Well, what about limiting changes and rewriting only to the commits\n> being rewritten by [interactive] rebase?  I mean that we would rewrite\n> \"revert 01a9fe8\" only if:\n>\n> a.) the commit with this message is undergoing rewrite\n> b.) the commit 01a9fe8 is undergoing rewrite in the same command\n>\n> We could use the infrastructure from git-filter-branch for this.\n>\n> It is serious limitation, but that might be good enough for Giuseppe\n> Crinò use case.  Though for example there is a question what to do if\n> referred-to commit (01a9fe8 in the example) is simply dropped, or is\n> gets split in two?  Ask user?\n>\n>\n> Another possibility would be to provide a command line option to rebase\n> which would automatically generate replacements (in git-replace meaning)\n> from old pre-rebase name to new post-rebase name (assuming no splitting,\n> no dropping commits).  This would make references just work... well, as\n> long as refs/replace/* are in place (they are not copied by default).\n>\n> On the other hand some of our performance-improving features, like the\n> commit-graph, do not work if there are replacements.\n>\n>\n> Best,\n> --\n> Jakub Narębski\n"},{"id":"374127","messageId":"CAGV3M55di4Nc_x25RoT0=dREkeCVc5_LpNabEjVDF+mSHK+0nQ@mail.gmail.com","threadId":"50946","inReplyTo":"86o953z0b9.fsf@gmail.com","subject":"Re: Feature request: Allow to update commit ID in messages when rebasing","fromName":"Giuseppe Crinò","fromEmail":"giuscri@gmail.com","sentAt":"2019-04-18T17:58:23Z","receivedAt":"2019-04-18T18:32:26Z","isPatch":false,"sender":{"key":"giuscri@gmail.com","avatar":"https://gravatar.com/avatar/0d6b46f6496321ee3646c8712de0b475e225f393a8c72d2c2385d7820b74dd90?d=mp&s=160"},"body":"On Thu, Apr 18, 2019 at 7:32 PM Jakub Narebski <jnareb@gmail.com> wrote:\n> Well, what about limiting changes and rewriting only to the commits\n> being rewritten by [interactive] rebase?  I mean that we would rewrite\n> \"revert 01a9fe8\" only if:\n>\n> a.) the commit with this message is undergoing rewrite\n> b.) the commit 01a9fe8 is undergoing rewrite in the same command\n>\n> We could use the infrastructure from git-filter-branch for this.\n>\n> It is serious limitation, but that might be good enough for Giuseppe\n> Crinò use case.\n\nIn which case you need to change the ID of \"revert 01a9fe8\" _even if_\n01a9fe8 is not involved in the rebase? Wouldn't be a solution to my\nuse-case an already complete solution?\n"},{"id":"374154","messageId":"86imvaz33v.fsf@gmail.com","threadId":"50946","inReplyTo":"CAGV3M55di4Nc_x25RoT0=dREkeCVc5_LpNabEjVDF+mSHK+0nQ@mail.gmail.com","subject":"Re: Feature request: Allow to update commit ID in messages when rebasing","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2019-04-19T10:44:20Z","receivedAt":"2019-04-19T19:19:52Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Hello,\n\nGiuseppe Crinò <giuscri@gmail.com> writes:\n> On Thu, Apr 18, 2019 at 7:32 PM Jakub Narebski <jnareb@gmail.com> wrote:\n\n>> Well, what about limiting changes and rewriting only to the commits\n>> being rewritten by [interactive] rebase?  I mean that we would rewrite\n>> \"revert 01a9fe8\" only if:\n>>\n>> a.) the commit with this message is undergoing rewrite\n>> b.) the commit 01a9fe8 is undergoing rewrite in the same command\n>>\n>> We could use the infrastructure from git-filter-branch for this.\n>>\n>> It is serious limitation, but that might be good enough for Giuseppe\n>> Crinò use case.\n>\n> In which case you need to change the ID of \"revert 01a9fe8\" _even if_\n> 01a9fe8 is not involved in the rebase? Wouldn't be a solution to my\n> use-case an already complete solution?\n\nWhat I meant by \"serious limitation\" is that the condition a.) might mot\nhold true.  You might be rebasing / rewriting the commit 01a9fe8, but\nthere might be some commit not undergoing rewrite (for example one on a\nseparate branch) that refers to the commit being rewritten, e.g. by\nincluding \"revert 01a9fe8\" in the commit message.\n\nWe also need to assume that the commit referred to (i.e. 01a9fe8) is\nbeing rewritten earlier in sequence than referring commit (i.e. one with\n\"revert 01a9fe8\").\n\nRegards,\n--\nJakub Narębski\n"}]}