X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=git-cherry.sh;h=8832573fee9d3b8d4be92786ae5116ee6e5405bb;hb=d1d866e9b8d5a6f0dbe490ba3467440bbf87feaf;hp=867522b37ff4fd85f963019a025ba07789ffef37;hpb=5e80092f7e6db09a40a62e837ca3f74f0bc5ad73;p=git.git diff --git a/git-cherry.sh b/git-cherry.sh index 867522b37..8832573fe 100755 --- a/git-cherry.sh +++ b/git-cherry.sh @@ -3,27 +3,24 @@ # Copyright (c) 2005 Junio C Hamano. # -. git-sh-setup - -usage="usage: $0 "'[-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 case "$#,$1" in 1,*..*) - upstream=$(expr "$1" : '\(.*\)\.\.') ours=$(expr "$1" : '.*\.\.\(.*\)$') + upstream=$(expr "z$1" : 'z\(.*\)\.\.') ours=$(expr "z$1" : '.*\.\.\(.*\)$') set x "$upstream" "$ours" shift ;; esac @@ -31,26 +28,29 @@ 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 ;; -*) echo >&2 "$usage"; exit 1 ;; +*) usage ;; 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 mkdir $patch trap "rm -rf $tmp-*" 0 1 2 3 15 -_x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]' -_x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40" - for c in $inup do git-diff-tree -p $c