git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / Atom feed
* [PATCH] t7004: check existence of correct tag
@ 2019-11-13 19:39 Martin Ågren
  2019-11-14  6:35 ` Jeff King
  0 siblings, 1 reply; 3+ messages in thread
From: Martin Ågren @ 2019-11-13 19:39 UTC (permalink / raw)
  To: git

We try to delete the non-existing tag "anothertag", but for the
verifications, we check that the tag "myhead" doesn't exist. "myhead"
isn't used in this test except for this checking. Comparing to the test
two tests earlier, it looks like a copy-paste mistake.

Perhaps it's overkill to check that `git tag -d` didn't decide to
*create* a tag. But since we're trying to be this careful, let's
actually check the correct tag. While we're doing this, let's use a more
descriptive tag name instead -- "nonexistingtag" should be obvious.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
---
 This is a resend of
 https://public-inbox.org/git/20190808125330.3104954-1-martin.agren@gmail.com/

 t/t7004-tag.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh
index 80eb13d94e..e4cf605907 100755
--- a/t/t7004-tag.sh
+++ b/t/t7004-tag.sh
@@ -227,10 +227,10 @@ test_expect_success \
 test_expect_success \
 	'trying to delete two tags, existing and not, should fail in the 2nd' '
 	tag_exists mytag &&
-	! tag_exists myhead &&
-	test_must_fail git tag -d mytag anothertag &&
+	! tag_exists nonexistingtag &&
+	test_must_fail git tag -d mytag nonexistingtag &&
 	! tag_exists mytag &&
-	! tag_exists myhead
+	! tag_exists nonexistingtag
 '
 
 test_expect_success 'trying to delete an already deleted tag should fail' \
-- 
2.24.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] t7004: check existence of correct tag
  2019-11-13 19:39 [PATCH] t7004: check existence of correct tag Martin Ågren
@ 2019-11-14  6:35 ` Jeff King
  0 siblings, 0 replies; 3+ messages in thread
From: Jeff King @ 2019-11-14  6:35 UTC (permalink / raw)
  To: Martin Ågren; +Cc: git

On Wed, Nov 13, 2019 at 08:39:02PM +0100, Martin Ågren wrote:

> We try to delete the non-existing tag "anothertag", but for the
> verifications, we check that the tag "myhead" doesn't exist. "myhead"
> isn't used in this test except for this checking. Comparing to the test
> two tests earlier, it looks like a copy-paste mistake.

Thanks, the description and patch look good to me.

> Perhaps it's overkill to check that `git tag -d` didn't decide to
> *create* a tag. But since we're trying to be this careful, let's
> actually check the correct tag. While we're doing this, let's use a more
> descriptive tag name instead -- "nonexistingtag" should be obvious.

Yes, that would be a spectacular bug indeed. :)

I think it's fine to keep it in, though, as it communicates the
expectations pretty clearly.

-Peff

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] t7004: check existence of correct tag
  2019-08-08 12:47 [PATCH 1/1] delete multiple tags in a single transaction Martin Ågren
@ 2019-08-08 12:53 ` Martin Ågren
  0 siblings, 0 replies; 3+ messages in thread
From: Martin Ågren @ 2019-08-08 12:53 UTC (permalink / raw)
  To: Phil Hord; +Cc: git

We try to delete the non-existing tag "anothertag", but for the
verifications, we check that the tag "myhead" doesn't exist. "myhead"
isn't used in this test except for this checking. Comparing to the test
two tests earlier, it looks like a copy-paste mistake.

Perhaps it's overkill to check that `git tag -d` didn't decide to
*create* a tag. But since we're trying to be this careful, let's
actually check the correct tag. While we're doing this, let's use a more
descriptive tag name instead -- "nonexistingtag" should be obvious.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
---

 > Probably worth inspecting the output of that `git tag -d` a bit in
 > t7004, to make sure we just claim to delete one tag, and have errors.

 Here's something I noticed while looking into this test. If you do
 expand on this test, feel free to pick this up, either as a preparatory
 patch or squash it into your "expand test" patch (if you do one). If
 you don't pick this up at all, I'll pursue it separately, later.

 Martin

 t/t7004-tag.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh
index 80eb13d94e..e4cf605907 100755
--- a/t/t7004-tag.sh
+++ b/t/t7004-tag.sh
@@ -227,10 +227,10 @@ test_expect_success \
 test_expect_success \
 	'trying to delete two tags, existing and not, should fail in the 2nd' '
 	tag_exists mytag &&
-	! tag_exists myhead &&
-	test_must_fail git tag -d mytag anothertag &&
+	! tag_exists nonexistingtag &&
+	test_must_fail git tag -d mytag nonexistingtag &&
 	! tag_exists mytag &&
-	! tag_exists myhead
+	! tag_exists nonexistingtag
 '
 
 test_expect_success 'trying to delete an already deleted tag should fail' \
-- 
2.23.0.rc0.30.g51cf315870


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-11-14  6:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-13 19:39 [PATCH] t7004: check existence of correct tag Martin Ågren
2019-11-14  6:35 ` Jeff King
  -- strict thread matches above, loose matches on Subject: below --
2019-08-08 12:47 [PATCH 1/1] delete multiple tags in a single transaction Martin Ågren
2019-08-08 12:53 ` [PATCH] t7004: check existence of correct tag Martin Ågren

git@vger.kernel.org list mirror (unofficial, one of many)

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 git git/ https://public-inbox.org/git \
		git@vger.kernel.org
	public-inbox-index git

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://ou63pmih66umazou.onion/inbox.comp.version-control.git
	nntp://czquwvybam4bgbro.onion/inbox.comp.version-control.git
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.version-control.git
	nntp://news.gmane.io/gmane.comp.version-control.git
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for the project(s) associated with this inbox:

	https://80x24.org/mirrors/git.git

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git