From: Yann Dirson Date: Sun, 8 Jan 2006 00:40:33 +0000 (+0100) Subject: Add an optional limit to git-cherry X-Git-Tag: v1.1.0~3 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=77f1055ca7728d3ac1e7d3ce9f29c0c6d4f842c5;p=git.git Add an optional limit to git-cherry This allows to use another commit than the merge base as a limit for scanning patches. [jc: part about t3500 test omitted.] Signed-off-by: Yann Dirson Signed-off-by: Junio C Hamano --- diff --git a/git-cherry.sh b/git-cherry.sh index 5e9bd0caf..1a6232013 100755 --- a/git-cherry.sh +++ b/git-cherry.sh @@ -3,17 +3,17 @@ # Copyright (c) 2005 Junio C Hamano. # -USAGE='[-v] []' +USAGE='[-v] [] []' LONG_USAGE=' __*__*__*__*__> / fork-point \__+__+__+__+__+__+__+__> -Each commit between the fork-point and is examined, and -compared against the change each commit between the fork-point and - introduces. If the change seems to be in the upstream, -it is shown on the standard output with prefix "+". Otherwise -it is shown with prefix "-".' +Each commit between the fork-point (or if given) and is +examined, and compared against the change each commit between the +fork-point and introduces. If the change seems to be in +the upstream, it is shown on the standard output with prefix "+". +Otherwise it is shown with prefix "-".' . git-sh-setup case "$1" in -v) verbose=t; shift ;; esac @@ -28,9 +28,15 @@ esac case "$#" in 1) upstream=`git-rev-parse --verify "$1"` && ours=`git-rev-parse --verify HEAD` || exit + limit="$upstream" ;; 2) upstream=`git-rev-parse --verify "$1"` && ours=`git-rev-parse --verify "$2"` || exit + limit="$upstream" + ;; +3) upstream=`git-rev-parse --verify "$1"` && + ours=`git-rev-parse --verify "$2"` && + limit=`git-rev-parse --verify "$3"` || exit ;; *) usage ;; esac @@ -38,7 +44,7 @@ esac # Note that these list commits in reverse order; # not that the order in inup matters... inup=`git-rev-list ^$ours $upstream` && -ours=`git-rev-list $ours ^$upstream` || exit +ours=`git-rev-list $ours ^$limit` || exit tmp=.cherry-tmp$$ patch=$tmp-patch