Subject: [PATCH 1/2] fetch: add a test for --force flag

From: "Orgad Shaneh via GitGitGadget" <[email-masked]>
Date: Sun, 15 Feb 2026 20:23:35 +0000

From: Orgad Shaneh <[email-masked]>

There are two ways to force-fetch tags that have changed: either by
specifying an explicit forced ref (+refs/tags/*:refs/tags/*), or by
using --force.

The first approach was already tested, but the second was not. This
has now been addressed.

Signed-off-by: Orgad Shaneh <[email-masked]>
---
 t/t5516-fetch-push.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
index 29e2f17608..31df7faf56 100755
--- a/t/t5516-fetch-push.sh
+++ b/t/t5516-fetch-push.sh
@@ -1105,7 +1105,10 @@ 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/*' &&
+			git tag $tag_args testTag HEAD^ &&
+			test_must_fail git -C ../child1 fetch origin tag testTag &&
+			git -C ../child1 fetch --force origin tag testTag
 		)
 	"
 }
-- 
gitgitgadget