aboutsummaryrefslogtreecommitdiff
path: root/git-format-patch.sh
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-11-21 12:17:22 -0800
committerJunio C Hamano <junkio@cox.net>2005-11-21 12:21:24 -0800
commit88b5a74883f146eac4b15b30e74bbdeb5ab5a63a (patch)
treee7d0f36f60800d43a822b957ab5efd309da47130 /git-format-patch.sh
parent60abce3c0f41952de7dc1a4abefcb988898b71a4 (diff)
downloadgit-88b5a74883f146eac4b15b30e74bbdeb5ab5a63a.tar.gz
git-88b5a74883f146eac4b15b30e74bbdeb5ab5a63a.tar.xz
format-patch: fix two-argument special case, and make it easier to pick single commits
Luben Tuikov noticed that sometimes being able to say 'git-format-patch <commit>' to format the change a single commit introduces relative to its parent is handy. This patch does not support that directly, but it makes sense to interpret a single argument "rev" to mean "rev^1..rev". With this, the backward compatibility syntaxes still apply: - "format-patch master" means "format-patch master..HEAD" - "format-patch origin master" means "format-patch origin..master" - "format-patch origin.." means "format-patch origin..HEAD" But "format-patch a b c d e" formats the changes these five commits introduce relative to their respective parents. Earlier it rejected these arguments not in "one..two" form. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-format-patch.sh')
-rwxr-xr-xgit-format-patch.sh5
1 files changed, 3 insertions, 2 deletions
diff --git a/git-format-patch.sh b/git-format-patch.sh
index 7ee5d328c..351790c44 100755
--- a/git-format-patch.sh
+++ b/git-format-patch.sh
@@ -99,7 +99,7 @@ filelist=$tmp-files
# Also, "rev1.." should mean "rev1..HEAD"; git-diff users are
# familiar with that syntax.
-case "$#,$1" in
+case "$#,$1$2" in
1,?*..?*)
# single "rev1..rev2"
;;
@@ -131,7 +131,8 @@ do
rev2=`expr "$revpair" : '.*\.\.\(.*\)'`
;;
*)
- usage
+ rev1="$revpair^"
+ rev2="$revpair"
;;
esac
git-rev-parse --verify "$rev1^0" >/dev/null 2>&1 ||