aboutsummaryrefslogtreecommitdiff
path: root/git-format-patch-script
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-08-07 15:51:09 -0700
committerJunio C Hamano <junkio@cox.net>2005-08-09 23:38:50 -0700
commit4282c4fbddfeae3383c6c327e2ca98b25500ea31 (patch)
tree0d999918a638a97e65724117d7a2e12c0e665d8a /git-format-patch-script
parent32173e69881a35e4e7a53be3ba80091ae9fa8f35 (diff)
downloadgit-4282c4fbddfeae3383c6c327e2ca98b25500ea31.tar.gz
git-4282c4fbddfeae3383c6c327e2ca98b25500ea31.tar.xz
Teach format-patch, rebase and cherry a..b format
Although these commands take only begin and end, not necessarily generic SHA1 expressions rev-parse supports, supporting a..b notation is good for consistency. This commit adds such without breaking backward compatibility. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-format-patch-script')
-rwxr-xr-xgit-format-patch-script21
1 files changed, 15 insertions, 6 deletions
diff --git a/git-format-patch-script b/git-format-patch-script
index 51e8af0ac..003194cdd 100755
--- a/git-format-patch-script
+++ b/git-format-patch-script
@@ -3,6 +3,8 @@
# Copyright (c) 2005 Junio C Hamano
#
+. git-sh-setup-script || die "Not a git archive."
+
usage () {
echo >&2 "usage: $0"' [-n] [-o dir] [--mbox] [--check] [-<diff options>...] upstream [ our-head ]
@@ -60,13 +62,20 @@ do
shift
done
+revpair=
case "$#" in
-2) linus="$1" junio="$2" ;;
-1) linus="$1" junio=HEAD ;;
-*) usage ;;
+2)
+ revpair="$1..$2" ;;
+1)
+ case "$1" in
+ *..*)
+ revpair="$1";;
+ *)
+ revpair="$1..HEAD";;
+ esac ;;
+*)
+ usage ;;
esac
-junio=`git-rev-parse --verify "$junio"`
-linus=`git-rev-parse --verify "$linus"`
me=`git-var GIT_AUTHOR_IDENT | sed -e 's/>.*/>/'`
@@ -108,7 +117,7 @@ _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"
stripCommitHead='/^'"$_x40"' (from '"$_x40"')$/d'
-git-rev-list --merge-order "$junio" "^$linus" >$series
+git-rev-list --merge-order $(git-rev-parse --revs-only "$revpair") >$series
total=`wc -l <$series | tr -dc "[0-9]"`
i=$total
while read commit