{"thread":{"id":"8493","subject":"[PATCH/RFC] filter-branch: support skipping of commits more easily","startedAt":"2007-06-07T23:59:48Z","lastAt":"2007-06-08T06:40:53Z","messageCount":4,"participants":["Johannes Schindelin","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"44291","messageId":"Pine.LNX.4.64.0706080058160.4046@racer.site","threadId":"8493","inReplyTo":null,"subject":"[PATCH/RFC] filter-branch: support skipping of commits more easily","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-06-07T23:59:48Z","receivedAt":"2007-06-07T23:59:48Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nWhen commit-filter echoes just \"skip\", just skip that commit by mapping \nits object name to the same (possibly rewritten) object name(s) its \nparent(s) are mapped to.\n\nIOW, given A-B-C, if commit-filter says \"skip\" upon B, the rewritten \nbranch will look like this: A'-C'.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n\n\tOf course, if you think of \"patchsets\", this behaviour might\n\tbe unexpected, since the children will still contain everything\n\twhich was changed in the skipped revisions, and not changed in\n\t_them_.\n\n git-filter-branch.sh |   15 ++++++++++++---\n 1 files changed, 12 insertions(+), 3 deletions(-)\n\ndiff --git a/git-filter-branch.sh b/git-filter-branch.sh\nindex 9d61b7f..e6ed7b9 100755\n--- a/git-filter-branch.sh\n+++ b/git-filter-branch.sh\n@@ -102,6 +102,9 @@\n #\tmultiple commit ids; in that case, all of them will be used\n #\tas parents instead of the original commit in further commits.\n #\n+#\tFor the common case, that this commit should be skipped, just\n+#\toutput a single \"skip\".\n+#\n # --tag-name-filter COMMAND:: The filter for rewriting tag names.\n #\tIf this filter is passed, it will be called for every tag ref\n #\tthat points to a rewritten object (or to a tag object which\n@@ -321,7 +324,7 @@ test $commits -eq 0 && die \"Found nothing to rewrite\"\n i=0\n while read commit; do\n \ti=$(($i+1))\n-\tprintf \"$commit ($i/$commits) \"\n+\tprintf \"\\rRewriting commits... ($i/$commits)\"\n \n \tgit-read-tree -i -m $commit\n \n@@ -358,8 +361,14 @@ while read commit; do\n \n \tsed -e '1,/^$/d' <../commit | \\\n \t\teval \"$filter_msg\" | \\\n-\t\tsh -c \"$filter_commit\" git-commit-tree $(git-write-tree) $parentstr | \\\n-\t\ttee ../map/$commit\n+\t\tsh -c \"$filter_commit\" \\\n+\t\t\tgit-commit-tree $(git-write-tree) $parentstr \\\n+\t\t> ../map/$commit\n+\n+\ttest skip = \"$(cat ../map/$commit)\" &&\n+\t\tfor parent in $(get_parents $commit); do\n+\t\t\tmap \"$parent\"\n+\t\tdone > ../map/$commit\n done <../revs\n \n src_head=$(tail -n 1 ../revs)\n-- \n1.5.2.1.2689.gaf768-dirty\n"},{"id":"44296","messageId":"7v7iqfnuo3.fsf@assigned-by-dhcp.cox.net","threadId":"8493","inReplyTo":"Pine.LNX.4.64.0706080058160.4046@racer.site","subject":"Re: [PATCH/RFC] filter-branch: support skipping of commits more easily","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-06-08T00:42:36Z","receivedAt":"2007-06-08T00:42:36Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> When commit-filter echoes just \"skip\", just skip that commit by mapping \n> its object name to the same (possibly rewritten) object name(s) its \n> parent(s) are mapped to.\n>\n> IOW, given A-B-C, if commit-filter says \"skip\" upon B, the rewritten \n> branch will look like this: A'-C'.\n>\n> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n> ---\n>\n> \tOf course, if you think of \"patchsets\", this behaviour might\n> \tbe unexpected, since the children will still contain everything\n> \twhich was changed in the skipped revisions, and not changed in\n> \t_them_.\n\nI think that is fine; in effect, by saying \"skip\" B, you are\nsquashing B-C into C'.\n\nDoes this mean that, given\n\n          C---D---E\n         /   /\n\tA---B\n\nand if commit-filter says \"skip\" on D, the written history would\nlook like this?\n\n          C'------E'\n         /       /\n\tA'--B'--'\n\nThe new commit E' would become an evil merge that has difference\nbetween D and E in the original history?\n\nI am not objecting; just trying to get a mental picture.\n"},{"id":"44303","messageId":"Pine.LNX.4.64.0706080455440.4046@racer.site","threadId":"8493","inReplyTo":"7v7iqfnuo3.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH/RFC] filter-branch: support skipping of commits more easily","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-06-08T04:17:17Z","receivedAt":"2007-06-08T04:17:17Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 7 Jun 2007, Junio C Hamano wrote:\n\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> \n> > When commit-filter echoes just \"skip\", just skip that commit by mapping \n> > its object name to the same (possibly rewritten) object name(s) its \n> > parent(s) are mapped to.\n> >\n> > IOW, given A-B-C, if commit-filter says \"skip\" upon B, the rewritten \n> > branch will look like this: A'-C'.\n> >\n> > Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n> > ---\n> >\n> > \tOf course, if you think of \"patchsets\", this behaviour might\n> > \tbe unexpected, since the children will still contain everything\n> > \twhich was changed in the skipped revisions, and not changed in\n> > \t_them_.\n> \n> I think that is fine; in effect, by saying \"skip\" B, you are\n> squashing B-C into C'.\n> \n> Does this mean that, given\n> \n>           C---D---E\n>          /   /\n> \tA---B\n> \n> and if commit-filter says \"skip\" on D, the written history would\n> look like this?\n> \n>           C'------E'\n>          /       /\n> \tA'--B'--'\n> \n> The new commit E' would become an evil merge that has difference\n> between D and E in the original history?\n> \n> I am not objecting; just trying to get a mental picture.\n\nYeah, but you called it \"squash\" instead of \"skip\". So, maybe it should \naccept \"squash\" to do that operation instead?\n\nCiao,\nDscho\n"},{"id":"44315","messageId":"7vzm3bkky2.fsf@assigned-by-dhcp.cox.net","threadId":"8493","inReplyTo":"Pine.LNX.4.64.0706080455440.4046@racer.site","subject":"Re: [PATCH/RFC] filter-branch: support skipping of commits more easily","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-06-08T06:40:53Z","receivedAt":"2007-06-08T06:40:53Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n>> > IOW, given A-B-C, if commit-filter says \"skip\" upon B, the rewritten \n>> > branch will look like this: A'-C'.\n>> >\n>> > Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n>> > ---\n>> >\n>> > \tOf course, if you think of \"patchsets\", this behaviour might\n>> > \tbe unexpected, since the children will still contain everything\n>> > \twhich was changed in the skipped revisions, and not changed in\n>> > \t_them_.\n>> \n>> I think that is fine; in effect, by saying \"skip\" B, you are\n>> squashing B-C into C'.\n>> ... \n>> I am not objecting; just trying to get a mental picture.\n>\n> Yeah, but you called it \"squash\" instead of \"skip\". So, maybe it should \n> accept \"squash\" to do that operation instead?\n\nSkip is logically correct, but this does sound like squashing to\nme.\n"}]}