{"thread":{"id":"3003","subject":"[PATCH 7/7] Add an optional limit to git-rebase","startedAt":"2006-01-08T00:41:20Z","lastAt":"2006-01-08T10:11:12Z","messageCount":5,"participants":["Yann Dirson","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":7},"messages":[{"id":"14284","messageId":"20060108004120.GO1113@nowhere.earth","threadId":"3003","inReplyTo":null,"subject":"[PATCH 7/7] Add an optional limit to git-rebase","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2006-01-08T00:41:20Z","receivedAt":"2006-01-08T00:41:20Z","isPatch":true,"sender":{"key":"ydirson@altern.org","avatar":"https://avatars.githubusercontent.com/u/1190950?v=4"},"body":"This patch adds a limit to restrict the list of patches to rebase.\n\nThis is useful when a set of patches were done against a given head,\nbut needs to be ported to a different head, as opposed to being ported\nto a descendant of the original head.  In such a case we only want to\nport our own patches, not those that make the two branches different\nupstream.\n\nSigned-off-by: Yann Dirson <ydirson@altern.org>\n\n\n---\n\n git-rebase.sh |   14 +++++++++++---\n 1 files changed, 11 insertions(+), 3 deletions(-)\n\nbf833136c7c4cc17e7e45b959b56cda11528c33a\ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex 16d4359..06c7e1a 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -3,10 +3,10 @@\n # Copyright (c) 2005 Junio C Hamano.\n #\n \n-USAGE='<upstream> [<head>]'\n+USAGE='<upstream> [<head>] [<limit>]'\n . git-sh-setup\n \n-case $# in 1|2) ;; *) usage ;; esac\n+case $# in 1|2|3) ;; *) usage ;; esac\n \n # Make sure we do not have .dotest\n if mkdir .dotest\n@@ -36,6 +36,14 @@ other=$(git-rev-parse --verify \"$1^0\") |\n # Make sure the branch to rebase is valid.\n head=$(git-rev-parse --verify \"${2-HEAD}^0\") || exit\n \n+# Set limit\n+case \"$#\" in\n+3)\n+\tlimit=$(git-rev-parse --verify \"$3^0\") || usage ;;\n+*)\n+\tlimit= ;;\n+esac\n+\n # If the branch to rebase is given, first switch to it.\n case \"$#\" in\n 2)\n@@ -62,5 +70,5 @@ then\n \texit 0\n fi\n \n-git-format-patch -k --stdout --full-index \"$other\" ORIG_HEAD |\n+git-format-patch -k --stdout --full-index \"$other\" ORIG_HEAD $limit |\n git am --binary -3 -k\n-- \n1.0.6-g8ecb\n\n-- \nYann Dirson    <ydirson@altern.org> |\nDebian-related: <dirson@debian.org> |   Support Debian GNU/Linux:\n                                    |  Freedom, Power, Stability, Gratis\n     http://ydirson.free.fr/        | Check <http://www.debian.org/>\n"},{"id":"14293","messageId":"7vu0cf5uc5.fsf@assigned-by-dhcp.cox.net","threadId":"3003","inReplyTo":"20060108004120.GO1113@nowhere.earth","subject":"Re: [PATCH 7/7] Add an optional limit to git-rebase","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-01-08T02:25:46Z","receivedAt":"2006-01-08T02:25:46Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Patches 5, 6, and 7 in the series sound useful, but could they\ncome with documentation updates please?\n"},{"id":"14299","messageId":"7vk6db12z7.fsf@assigned-by-dhcp.cox.net","threadId":"3003","inReplyTo":"20060108004120.GO1113@nowhere.earth","subject":"Re: [PATCH 7/7] Add an optional limit to git-rebase","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-01-08T09:30:20Z","receivedAt":"2006-01-08T09:30:20Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Yann Dirson <ydirson@altern.org> writes:\n\n> This patch adds a limit to restrict the list of patches to rebase.\n>\n> This is useful when a set of patches were done against a given head,\n> but needs to be ported to a different head, as opposed to being ported\n> to a descendant of the original head.  In such a case we only want to\n> port our own patches, not those that make the two branches different\n> upstream.\n\nThis usage makes sense, independent from your git-format-patch\n\"limit\" patch.  The patched argument to git-format-patch does\nnot match your git-format-patch changes AFAICT ;-).\n\n> -git-format-patch -k --stdout --full-index \"$other\" ORIG_HEAD |\n> +git-format-patch -k --stdout --full-index \"$other\" ORIG_HEAD $limit |\n\nIf all you want to do is to move the cut-off point more recent\nthan the merge base is, how about (without your git-format-patch\nchanges) doing something stupid like this instead?\n\n  git-format-patch -k --stdout --full-index ${limit:-\"$other\"} ORIG_HEAD\n"},{"id":"14302","messageId":"20060108100654.GF32585@nowhere.earth","threadId":"3003","inReplyTo":"7vk6db12z7.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH 7/7] Add an optional limit to git-rebase","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2006-01-08T10:06:54Z","receivedAt":"2006-01-08T10:06:54Z","isPatch":true,"sender":{"key":"ydirson@altern.org","avatar":"https://avatars.githubusercontent.com/u/1190950?v=4"},"body":"On Sun, Jan 08, 2006 at 01:30:20AM -0800, Junio C Hamano wrote:\n> Yann Dirson <ydirson@altern.org> writes:\n> \n> > This patch adds a limit to restrict the list of patches to rebase.\n> >\n> > This is useful when a set of patches were done against a given head,\n> > but needs to be ported to a different head, as opposed to being ported\n> > to a descendant of the original head.  In such a case we only want to\n> > port our own patches, not those that make the two branches different\n> > upstream.\n> \n> This usage makes sense, independent from your git-format-patch\n> \"limit\" patch.  The patched argument to git-format-patch does\n> not match your git-format-patch changes AFAICT ;-).\n\nD'oh, I knew I should always written a testsuite when changing the\nimplementation of a feature at such a late time in night.\n\n\n> > -git-format-patch -k --stdout --full-index \"$other\" ORIG_HEAD |\n> > +git-format-patch -k --stdout --full-index \"$other\" ORIG_HEAD $limit |\n> \n> If all you want to do is to move the cut-off point more recent\n> than the merge base is, how about (without your git-format-patch\n> changes) doing something stupid like this instead?\n> \n>   git-format-patch -k --stdout --full-index ${limit:-\"$other\"} ORIG_HEAD\n\nRight, that would even be closer to the version that had indeed been\ntested - it does have the advantage of passing t3401, though :)\n\n-- \nYann Dirson    <ydirson@altern.org> |\nDebian-related: <dirson@debian.org> |   Support Debian GNU/Linux:\n                                    |  Freedom, Power, Stability, Gratis\n     http://ydirson.free.fr/        | Check <http://www.debian.org/>\n"},{"id":"14303","messageId":"20060108101111.GG32585@nowhere.earth","threadId":"3003","inReplyTo":"7vu0cf5uc5.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH 7/7] Add an optional limit to git-rebase","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2006-01-08T10:11:12Z","receivedAt":"2006-01-08T10:11:12Z","isPatch":true,"sender":{"key":"ydirson@altern.org","avatar":"https://avatars.githubusercontent.com/u/1190950?v=4"},"body":"On Sat, Jan 07, 2006 at 06:25:46PM -0800, Junio C Hamano wrote:\n> Patches 5, 6, and 7 in the series sound useful, but could they\n> come with documentation updates please?\n\nRight, that sounds reasonable :)\n\nHowever, since my initial motivation was patch 7, and you correctly\npointed out that 5 and 6 are not needed for 7, I'm not sure what to do\nabout those 5 and 6.  I'll have to let your comments about patch 6\nsettle in my mind first :)\n\nBest regards,\n-- \nYann Dirson    <ydirson@altern.org> |\nDebian-related: <dirson@debian.org> |   Support Debian GNU/Linux:\n                                    |  Freedom, Power, Stability, Gratis\n     http://ydirson.free.fr/        | Check <http://www.debian.org/>\n"}]}