summaryrefslogtreecommitdiff
path: root/t/test-lib-functions.sh
diff options
context:
space:
mode:
authorLibravatar Ævar Arnfjörð Bjarmason <avarab@gmail.com>2021-01-12 21:17:58 +0100
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-01-12 14:04:41 -0800
commit999cfc4f45e90a2eafa9b170d0ab9f0f13cbddb8 (patch)
tree2a3b1daece11b88c946f4e30243bb798160c80aa /t/test-lib-functions.sh
parenttest-lib functions: document arguments to test_commit (diff)
downloadtgif-999cfc4f45e90a2eafa9b170d0ab9f0f13cbddb8.tar.xz
test-lib functions: add --author support to test_commit
Add support for --author to "test_commit". This will simplify some current and future tests, one of those is being changed here. Let's also line-wrap the "git commit" command invocation to make diffs that add subsequent options easier to add, as they'll only need to add a new option line. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/test-lib-functions.sh')
-rw-r--r--t/test-lib-functions.sh11
1 files changed, 10 insertions, 1 deletions
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index 194b601bc0..529f6264fe 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -185,6 +185,8 @@ debug () {
# Do not call test_tick before making a commit
# --signoff
# Invoke "git commit" with --signoff
+# --author=<author>
+# Invoke "git commit" with --author=<author>
#
# This will commit a file with the given contents and the given commit
# message, and tag the resulting commit with the given tag name.
@@ -193,6 +195,7 @@ debug () {
test_commit () {
notick= &&
+ author= &&
signoff= &&
indir= &&
while test $# != 0
@@ -201,6 +204,10 @@ test_commit () {
--notick)
notick=yes
;;
+ --author)
+ author="$2"
+ shift
+ ;;
--signoff)
signoff="$1"
;;
@@ -222,7 +229,9 @@ test_commit () {
then
test_tick
fi &&
- git ${indir:+ -C "$indir"} commit $signoff -m "$1" &&
+ git ${indir:+ -C "$indir"} commit \
+ ${author:+ --author "$author"} \
+ $signoff -m "$1" &&
git ${indir:+ -C "$indir"} tag "${4:-$1}"
}