t/test-lib-functions.sh: allow to specify the tag name to test_commit

The <message> part of test_commit() may not be appropriate for a tag name. So let's allow test_commit to accept a fourth argument to specify the tag name. Signed-off-by: Brandon Casey <bcasey@nvidia.com> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Brandon Casey committed Feb 12, 2013 at 02:17 UTC 4c9941943bebbe23039254cdda576ecd97e1d397
1 file changed +4 -4
t/test-lib-functions.sh
+4 -4
@@ -135,12 +135,12 @@ test_pause () {
135 fi
136 }
137
138 -# Call test_commit with the arguments "<message> [<file> [<contents>]]"
138 +# Call test_commit with the arguments "<message> [<file> [<contents> [<tag>]]]"
139 #
140 # This will commit a file with the given contents and the given commit
141 -# message. It will also add a tag with <message> as name.
141 +# message, and tag the resulting commit with the given tag name.
142 #
143 -# Both <file> and <contents> default to <message>.
143 +# <file>, <contents>, and <tag> all default to <message>.
144
145 test_commit () {
146 notick= &&
@@ -168,7 +168,7 @@ test_commit () {
168 test_tick
169 fi &&
170 git commit $signoff -m "$1" &&
171 - git tag "$1"
171 + git tag "${4:-$1}"
172 }
173
174 # Call test_merge with the arguments "<message> <commit>", where <commit>