X-Git-Url: https://git.octo.it/?p=git.git;a=blobdiff_plain;f=git-cherry.sh;h=f0e8831fa49ae46eb7ad664b6ad489e3974c9f91;hp=867522b37ff4fd85f963019a025ba07789ffef37;hb=HEAD;hpb=36d277c72d90d32f99616072b64a2652248f5264 diff --git a/git-cherry.sh b/git-cherry.sh index 867522b3..f0e8831f 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,17 +28,23 @@ 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