public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: "Dmitry V. Levin" <ldv@altlinux•org>
To: git@vger•kernel.org
Subject: [PATCH 1/2] test-lib.sh: introduce 4th argument to test_commit() specifying a tag name
Date: Sat, 31 Jul 2010 04:18:46 +0400	[thread overview]
Message-ID: <20100731001845.GA24129@wo.int.altlinux.org> (raw)
In-Reply-To: <AANLkTimeQA2_fQ_f2pQchbo1coj3=mV9TRPnbET8SQ4F@mail.gmail.com>

When fourth argument to test_commit() is specified, use it as a tag
name, unless it equals to empty string.  In the latter case, skip tag
creation.

Suggested-by: Ævar Arnfjörð Bjarmason <avarab@gmail•com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux•org>
---
 t/test-lib.sh |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/t/test-lib.sh b/t/test-lib.sh
index 367f053..a203383 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -277,10 +277,12 @@ test_tick () {
 	export GIT_COMMITTER_DATE GIT_AUTHOR_DATE
 }
 
-# Call test_commit with the arguments "<message> [<file> [<contents>]]"
+# Call test_commit with the arguments
+# "<message> [<file> [<contents> [<tagname>]]]"
 #
 # This will commit a file with the given contents and the given commit
-# message.  It will also add a tag with <message> as name.
+# message.  It will also add a tag with the given name unless the latter
+# is the empty string.
 #
 # Both <file> and <contents> default to <message>.
 
@@ -290,7 +292,7 @@ test_commit () {
 	git add "$file" &&
 	test_tick &&
 	git commit -m "$1" &&
-	git tag "$1"
+	if test -n "${4-$1}"; then git tag "${4-$1}"; fi
 }
 
 # Call test_merge with the arguments "<message> <commit>", where <commit>


-- 
ldv

  reply	other threads:[~2010-07-31  0:19 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-29 22:01 [PATCH] checkout: add a test for creating a new branch with regexp as a starting point Dmitry V. Levin
2010-07-29 23:07 ` Ævar Arnfjörð Bjarmason
2010-07-29 23:36   ` Thomas Rast
2010-08-02 21:04     ` Junio C Hamano
2010-07-30  8:44   ` Dmitry V. Levin
2010-07-30 11:54     ` Ævar Arnfjörð Bjarmason
2010-07-30 19:13       ` When to use test_commit (Re: [PATCH] checkout: add a test for creating a new branch with regexp as a starting point) Jonathan Nieder
2010-07-30 20:20         ` Ævar Arnfjörð Bjarmason
2010-07-31  0:18           ` Dmitry V. Levin [this message]
2010-07-31  0:39             ` [PATCH 1/2] test-lib.sh: introduce 4th argument to test_commit() specifying a tag name Ævar Arnfjörð Bjarmason
2010-07-31  1:56               ` [PATCH 1/2 v2] " Dmitry V. Levin
2010-07-31 10:23                 ` Ævar Arnfjörð Bjarmason
2010-07-31  0:19           ` [PATCH 2/2] checkout: add a test for creating a new branch with regexp as a starting point Dmitry V. Levin
2010-07-31  0:44             ` Ævar Arnfjörð Bjarmason
2010-07-31  1:44               ` [PATCH 2/2 v2] " Dmitry V. Levin
2010-07-31 10:24                 ` Ævar Arnfjörð Bjarmason
2010-08-05 21:24                   ` [PATCH 2/2 v3] " Dmitry V. Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100731001845.GA24129@wo.int.altlinux.org \
    --to=ldv@altlinux$(echo .)org \
    --cc=git@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox