{"thread":{"id":"3001","subject":"[PATCH 5/7] Add an optional limit to git-cherry","startedAt":"2006-01-08T00:40:33Z","lastAt":"2006-01-08T00:40:33Z","messageCount":1,"participants":["Yann Dirson"],"isPatch":true,"patchVersion":1,"patchTotal":7},"messages":[{"id":"14281","messageId":"20060108004033.GM1113@nowhere.earth","threadId":"3001","inReplyTo":null,"subject":"[PATCH 5/7] Add an optional limit to git-cherry","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2006-01-08T00:40:33Z","receivedAt":"2006-01-08T00:40:33Z","isPatch":true,"sender":{"key":"ydirson@altern.org","avatar":"https://avatars.githubusercontent.com/u/1190950?v=4"},"body":"This allows to use another commit than the merge base as a limit for\nscanning patches.\n\nSigned-off-by: Yann Dirson <ydirson@altern.org>\n\n\n---\n\n git-cherry.sh     |   20 +++++++++++++-------\n t/t3500-cherry.sh |    5 +++++\n 2 files changed, 18 insertions(+), 7 deletions(-)\n\nb1e23bf60c069a1f6bd4b8d04afd1fb80005e4ee\ndiff --git a/git-cherry.sh b/git-cherry.sh\nindex 5e9bd0c..1a62320 100755\n--- a/git-cherry.sh\n+++ b/git-cherry.sh\n@@ -3,17 +3,17 @@\n # Copyright (c) 2005 Junio C Hamano.\n #\n \n-USAGE='[-v] <upstream> [<head>]'\n+USAGE='[-v] <upstream> [<head>] [<limit>]'\n LONG_USAGE='             __*__*__*__*__> <upstream>\n             /\n   fork-point\n             \\__+__+__+__+__+__+__+__> <head>\n \n-Each commit between the fork-point and <head> is examined, and\n-compared against the change each commit between the fork-point and\n-<upstream> introduces.  If the change seems to be in the upstream,\n-it is shown on the standard output with prefix \"+\".  Otherwise\n-it is shown with prefix \"-\".'\n+Each commit between the fork-point (or <limit> if given) and <head> is\n+examined, and compared against the change each commit between the\n+fork-point and <upstream> introduces.  If the change seems to be in\n+the upstream, it is shown on the standard output with prefix \"+\".\n+Otherwise it is shown with prefix \"-\".'\n . git-sh-setup\n \n case \"$1\" in -v) verbose=t; shift ;; esac \n@@ -28,9 +28,15 @@ esac\n case \"$#\" in\n 1) upstream=`git-rev-parse --verify \"$1\"` &&\n    ours=`git-rev-parse --verify HEAD` || exit\n+   limit=\"$upstream\"\n    ;;\n 2) upstream=`git-rev-parse --verify \"$1\"` &&\n    ours=`git-rev-parse --verify \"$2\"` || exit\n+   limit=\"$upstream\"\n+   ;;\n+3) upstream=`git-rev-parse --verify \"$1\"` &&\n+   ours=`git-rev-parse --verify \"$2\"` &&\n+   limit=`git-rev-parse --verify \"$3\"` || exit\n    ;;\n *) usage ;;\n esac\n@@ -38,7 +44,7 @@ esac\n # Note that these list commits in reverse order;\n # not that the order in inup matters...\n inup=`git-rev-list ^$ours $upstream` &&\n-ours=`git-rev-list $ours ^$upstream` || exit\n+ours=`git-rev-list $ours ^$limit` || exit\n \n tmp=.cherry-tmp$$\n patch=$tmp-patch\ndiff --git a/t/t3500-cherry.sh b/t/t3500-cherry.sh\nindex f2f9109..7b81377 100755\n--- a/t/t3500-cherry.sh\n+++ b/t/t3500-cherry.sh\n@@ -38,6 +38,11 @@ test_expect_success \\\n '\n \n test_expect_success \\\n+    'check that cherry with limit returns only the top patch'\\\n+    'expr \"$(echo $(git-cherry master my-topic-branch my-topic-branch^1) )\" : \"+ [^ ]*\"\n+'\n+\n+test_expect_success \\\n     'cherry-pick one of the 2 patches, and check cherry recognized one and only one as new' \\\n     'git-cherry-pick my-topic-branch^0 &&\n      echo $(git-cherry master my-topic-branch) &&\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"}]}