{"thread":{"id":"30495","subject":"Equivalent of \"fixup\" for git filter-branch","startedAt":"2012-05-10T16:30:26Z","lastAt":"2012-05-12T12:12:54Z","messageCount":7,"participants":["Philippe Vaucher","Andreas Schwab"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"191315","messageId":"CAGK7Mr5D0WQn-Tc1B5=F7+3OgZd1uy54Be-ZrbyFv0CP8JY5bw@mail.gmail.com","threadId":"30495","inReplyTo":null,"subject":"Equivalent of \"fixup\" for git filter-branch","fromName":"Philippe Vaucher","fromEmail":"philippe.vaucher@gmail.com","sentAt":"2012-05-10T16:30:26Z","receivedAt":"2012-05-10T16:30:26Z","isPatch":false,"sender":{"key":"philippe.vaucher@gmail.com","avatar":null},"body":"Hello,\n\nI know there is `skip_commit` for git filter branch with\n--commit-filter which squash the current commit with the next one,\nhowever I have trouble finding a \"fixup\" equivalent that'd squash the\ncommit with the previous one (just like git rebase -i allows).\n\nYes, I know I could probably use git rebase instead but rebase doesn't\nkeep the existing commiter date like git filter-branch does.\n\nPhilippe\n"},{"id":"191331","messageId":"m21umsylz8.fsf@igel.home","threadId":"30495","inReplyTo":"CAGK7Mr5D0WQn-Tc1B5=F7+3OgZd1uy54Be-ZrbyFv0CP8JY5bw@mail.gmail.com","subject":"Re: Equivalent of \"fixup\" for git filter-branch","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2012-05-10T17:39:07Z","receivedAt":"2012-05-10T17:39:07Z","isPatch":false,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"Philippe Vaucher <philippe.vaucher@gmail.com> writes:\n\n> I know there is `skip_commit` for git filter branch with\n> --commit-filter which squash the current commit with the next one,\n> however I have trouble finding a \"fixup\" equivalent that'd squash the\n> commit with the previous one (just like git rebase -i allows).\n\nProbably doable with an index filter that updates the index for the\nparent commit with the contents of the fixup commit and a commit filter\nthat skips the fixup commit.\n\nAndreas.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5\n\"And now for something completely different.\"\n"},{"id":"191393","messageId":"CAGK7Mr43Mxn-oJBDt11u0RMnxT1tv9OfbH9qNufb9X05mKh22Q@mail.gmail.com","threadId":"30495","inReplyTo":"CAGK7Mr7qdTwfha8aUdXE4FeXjA0rW3JL0q=a9kHArirjv5bygg@mail.gmail.com","subject":"Re: Equivalent of \"fixup\" for git filter-branch","fromName":"Philippe Vaucher","fromEmail":"philippe.vaucher@gmail.com","sentAt":"2012-05-11T12:51:15Z","receivedAt":"2012-05-11T12:51:15Z","isPatch":false,"sender":{"key":"philippe.vaucher@gmail.com","avatar":null},"body":"> > I know there is `skip_commit` for git filter branch with\n> > --commit-filter which squash the current commit with the next one,\n> > however I have trouble finding a \"fixup\" equivalent that'd squash the\n> > commit with the previous one (just like git rebase -i allows).\n>\n> Probably doable with an index filter that updates the index for the\n> parent commit with the contents of the fixup commit and a commit filter\n> that skips the fixup commit.\n\n\nHum, I'm unsure about how this would look... can I use \"git commit\n--amend\" inside a commit-filter?\n\nAlso, how can I know in advance that the next commit will be a fixup commit?\n\nThanks,\nPhilippe\n"},{"id":"191394","messageId":"m2havmop75.fsf@igel.home","threadId":"30495","inReplyTo":"CAGK7Mr7qdTwfha8aUdXE4FeXjA0rW3JL0q=a9kHArirjv5bygg@mail.gmail.com","subject":"Re: Equivalent of \"fixup\" for git filter-branch","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2012-05-11T12:51:58Z","receivedAt":"2012-05-11T12:51:58Z","isPatch":false,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"Philippe Vaucher <philippe.vaucher@gmail.com> writes:\n\n>>\n>> > I know there is `skip_commit` for git filter branch with\n>> > --commit-filter which squash the current commit with the next one,\n>> > however I have trouble finding a \"fixup\" equivalent that'd squash the\n>> > commit with the previous one (just like git rebase -i allows).\n>>\n>> Probably doable with an index filter that updates the index for the\n>> parent commit with the contents of the fixup commit and a commit filter\n>> that skips the fixup commit.\n>\n>\n> Hum, I'm unsure about how this would look... can I use \"git commit --amend\"\n> inside a commit-filter?\n\nI don't think that will work if the amended commit has more than one\nchildren, since the result won't be reflected in the map function.\n\n> Also, how can I know in advance that the next commit will be a fixup commit?\n\nIn the index filter, when $GIT_COMMIT equals the parent of the fixup\ncommit, update the index with git read-tree from the fixup commit.\n\nAndreas.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5\n\"And now for something completely different.\"\n"},{"id":"191395","messageId":"CAGK7Mr6Z44iJqATgiWHXeutOHJM-vXauYeyYB0Z6c+mGYCr1Cg@mail.gmail.com","threadId":"30495","inReplyTo":"m2havmop75.fsf@igel.home","subject":"Re: Equivalent of \"fixup\" for git filter-branch","fromName":"Philippe Vaucher","fromEmail":"philippe.vaucher@gmail.com","sentAt":"2012-05-11T13:04:18Z","receivedAt":"2012-05-11T13:04:18Z","isPatch":false,"sender":{"key":"philippe.vaucher@gmail.com","avatar":null},"body":">> Also, how can I know in advance that the next commit will be a fixup commit?\n>\n> In the index filter, when $GIT_COMMIT equals the parent of the fixup\n> commit, update the index with git read-tree from the fixup commit.\n\nRight, good idea.\n\nI was also thinking maybe I could use --parent-filter: when I find a\nfixup commit, I set its parent to its parent's parent?\n\nPhilippe\n"},{"id":"191396","messageId":"m2d36aompd.fsf@igel.home","threadId":"30495","inReplyTo":"CAGK7Mr6Z44iJqATgiWHXeutOHJM-vXauYeyYB0Z6c+mGYCr1Cg@mail.gmail.com","subject":"Re: Equivalent of \"fixup\" for git filter-branch","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2012-05-11T13:45:50Z","receivedAt":"2012-05-11T13:45:50Z","isPatch":false,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"Philippe Vaucher <philippe.vaucher@gmail.com> writes:\n\n> I was also thinking maybe I could use --parent-filter: when I find a\n> fixup commit, I set its parent to its parent's parent?\n\nThis will keep the attributes of the fixup commit, discarding the\nparent's ones.  In git rebase, a fixup keeps the attributes of the\nparent, discarding the ones of the fixup.\n\nAndreas.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5\n\"And now for something completely different.\"\n"},{"id":"191450","messageId":"CAGK7Mr6dMA=r3omxUgvozxi0o_rzF3ZwDwJB3FzNWW41OXYiTg@mail.gmail.com","threadId":"30495","inReplyTo":"m2d36aompd.fsf@igel.home","subject":"Re: Equivalent of \"fixup\" for git filter-branch","fromName":"Philippe Vaucher","fromEmail":"philippe.vaucher@gmail.com","sentAt":"2012-05-12T12:12:54Z","receivedAt":"2012-05-12T12:12:54Z","isPatch":false,"sender":{"key":"philippe.vaucher@gmail.com","avatar":null},"body":"> > I was also thinking maybe I could use --parent-filter: when I find a\n> > fixup commit, I set its parent to its parent's parent?\n>\n> This will keep the attributes of the fixup commit, discarding the\n> parent's ones.  In git rebase, a fixup keeps the attributes of the\n> parent, discarding the ones of the fixup.\n\nAh right. Thanks for your suggestions, I'll try to get it going. Maybe\nthe result could be material for more examples in the man page.\n\nPhilippe\n"}]}