From: Orgad Shaneh <orgads@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>, "Jeff King" <peff@peff.net>,
"Karthik Nayak" <karthik.188@gmail.com>,
"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: [PATCH v2 1/2] fetch: test that --force clobbers a changed tag
Date: Sat, 21 Nov 2026 21:46:32 +0000 [thread overview]
Message-ID: <20261121214633.1523706-2-orgads@gmail.com> (raw)
In-Reply-To: <20261121214633.1523706-1-orgads@gmail.com>
Changed tags can be force-fetched with a "+" refspec or with --force,
but only the refspec was tested. The test also didn't check that the
tag was actually updated, only that fetch succeeded.
Add the --force case, and check the tag after each forced fetch.
Signed-off-by: Orgad Shaneh <orgads@gmail.com>
---
t/t5516-fetch-push.sh | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
index 2f46ddc9ba..68e0e2de27 100755
--- a/t/t5516-fetch-push.sh
+++ b/t/t5516-fetch-push.sh
@@ -1160,6 +1160,12 @@ test_force_push_tag () {
test_force_push_tag "lightweight tag" "-f"
test_force_push_tag "annotated tag" "-f -a -m'tag message'"
+check_child1_tag () {
+ git rev-parse testTag >expect &&
+ git -C ../child1 rev-parse testTag >actual &&
+ test_cmp expect actual
+}
+
test_force_fetch_tag () {
tag_type_description=$1
tag_args=$2
@@ -1177,7 +1183,12 @@ test_force_fetch_tag () {
git commit -m 'file1' &&
git tag $tag_args testTag &&
test_must_fail git -C ../child1 fetch origin tag testTag &&
- git -C ../child1 fetch origin '+refs/tags/*:refs/tags/*'
+ git -C ../child1 fetch origin '+refs/tags/*:refs/tags/*' &&
+ check_child1_tag &&
+ git tag $tag_args testTag HEAD^ &&
+ test_must_fail git -C ../child1 fetch origin tag testTag &&
+ git -C ../child1 fetch --force origin tag testTag &&
+ check_child1_tag
)
"
}
--
2.53.0
next prev parent reply other threads:[~2026-11-21 21:46 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-15 20:23 [PATCH 0/2] fetch: clobber existing tags with --prune-tags Orgad Shaneh via GitGitGadget
2026-02-15 20:23 ` [PATCH 1/2] fetch: add a test for --force flag Orgad Shaneh via GitGitGadget
2026-02-15 20:23 ` [PATCH 2/2] fetch: clobber existing tags with --prune-tags Orgad Shaneh via GitGitGadget
2026-03-18 8:27 ` Orgad Shaneh
2026-03-21 18:26 ` Junio C Hamano
2026-03-26 7:57 ` Orgad Shaneh
2026-09-13 19:03 ` Orgad Shaneh
2026-09-13 22:57 ` Junio C Hamano
2026-10-06 17:44 ` Orgad Shaneh
2026-11-21 21:46 ` [PATCH v2 0/2] fetch: make --prune-tags clobber changed tags Orgad Shaneh
2026-11-21 21:46 ` Orgad Shaneh [this message]
2026-11-21 21:46 ` [PATCH v2 2/2] " Orgad Shaneh
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=20261121214633.1523706-2-orgads@gmail.com \
--to=orgads@gmail.com \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=karthik.188@gmail.com \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.