summaryrefslogtreecommitdiff
path: root/t/test-lib-functions.sh
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2012-09-14 08:52:03 +0200
committerJunio C Hamano <gitster@pobox.com>2012-09-14 10:04:29 -0700
commit5ed75e2a3fb30f93fea7772e481ec6091e9a2c5f (patch)
treeea0dc3f146a6a31dcb166dc3310376a1c8ddecc9 /t/test-lib-functions.sh
parentce5cf6ffc6feb9fb4f9a50cdfa2f527fa119c94f (diff)
downloadgit-5ed75e2a3fb30f93fea7772e481ec6091e9a2c5f.tar.gz
cherry-pick: don't forget -s on failure
In case 'git cherry-pick -s <commit>' failed, the user had to use 'git commit -s' (i.e. state the -s option again), which is easy to forget about. Instead, write the signed-off-by line early, so plain 'git commit' will have the same result. Also update 'git commit -s', so that in case there is already a relevant Signed-off-by line before the Conflicts: line, it won't add one more at the end of the message. If there is no such line, then add it before the the Conflicts: line. Signed-off-by: Miklos Vajna <vmiklos@suse.cz> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/test-lib-functions.sh')
-rw-r--r--t/test-lib-functions.sh21
1 files changed, 16 insertions, 5 deletions
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index 9bc57d27e9..8889ba5104 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -144,11 +144,22 @@ test_pause () {
test_commit () {
notick= &&
- if test "z$1" = "z--notick"
- then
- notick=yes
+ signoff= &&
+ while test $# != 0
+ do
+ case "$1" in
+ --notick)
+ notick=yes
+ ;;
+ --signoff)
+ signoff="$1"
+ ;;
+ *)
+ break
+ ;;
+ esac
shift
- fi &&
+ done &&
file=${2:-"$1.t"} &&
echo "${3-$1}" > "$file" &&
git add "$file" &&
@@ -156,7 +167,7 @@ test_commit () {
then
test_tick
fi &&
- git commit -m "$1" &&
+ git commit $signoff -m "$1" &&
git tag "$1"
}