@matheusbsbs / matheus-bagliano / commits / 77f1055ca7
Fork 0

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 <ydirson@altern.org> Signed-off-by: Junio C Hamano <junkio@cox.net>

Yann Dirson committed Jan 8, 2006 at 01:40 UTC 77f1055ca7728d3ac1e7d3ce9f29c0c6d4f842c5
1 file changed +13 -7
git-cherry.sh
+13 -7
@@ -3,17 +3,17 @@
3 # Copyright (c) 2005 Junio C Hamano.
4 #
5
6 -USAGE='[-v] <upstream> [<head>]'
6 +USAGE='[-v] <upstream> [<head>] [<limit>]'
7 LONG_USAGE=' __*__*__*__*__> <upstream>
8 /
9 fork-point
10 \__+__+__+__+__+__+__+__> <head>
11
12 -Each commit between the fork-point and <head> is examined, and
13 -compared against the change each commit between the fork-point and
14 -<upstream> introduces. If the change seems to be in the upstream,
15 -it is shown on the standard output with prefix "+". Otherwise
16 -it is shown with prefix "-".'
12 +Each commit between the fork-point (or <limit> if given) and <head> is
13 +examined, and compared against the change each commit between the
14 +fork-point and <upstream> introduces. If the change seems to be in
15 +the upstream, it is shown on the standard output with prefix "+".
16 +Otherwise it is shown with prefix "-".'
17 . git-sh-setup
18
19 case "$1" in -v) verbose=t; shift ;; esac
@@ -28,9 +28,15 @@ esac
28 case "$#" in
29 1) upstream=`git-rev-parse --verify "$1"` &&
30 ours=`git-rev-parse --verify HEAD` || exit
31 + limit="$upstream"
32 ;;
33 2) upstream=`git-rev-parse --verify "$1"` &&
34 ours=`git-rev-parse --verify "$2"` || exit
35 + limit="$upstream"
36 + ;;
37 +3) upstream=`git-rev-parse --verify "$1"` &&
38 + ours=`git-rev-parse --verify "$2"` &&
39 + limit=`git-rev-parse --verify "$3"` || exit
40 ;;
41 *) usage ;;
42 esac
@@ -38,7 +44,7 @@ esac
44 # Note that these list commits in reverse order;
45 # not that the order in inup matters...
46 inup=`git-rev-list ^$ours $upstream` &&
41 -ours=`git-rev-list $ours ^$upstream` || exit
47 +ours=`git-rev-list $ours ^$limit` || exit
48
49 tmp=.cherry-tmp$$
50 patch=$tmp-patch