git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Orgad Shaneh via GitGitGadget <gitgitgadget@gmail.com>
Date
Feb 15, 2026, 20:23 UTC
Message-ID
<3ef70fe673170925ccf2901a625fb458837e9fcf.1771187016.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.2200.git.git.1771187016.gitgitgadget@gmail.com>
From: Orgad Shaneh <orgad.shaneh@audiocodes.com>

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 <orgad.shaneh@audiocodes.com>
---
 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
Previous: Orgad Shaneh via GitGitGadgetNext: Orgad Shaneh via GitGitGadget
Message 2 of 9 in “fetch: clobber existing tags with --prune-tags”
  1. 0/2 fetch: clobber existing tags with --prune-tagsOrgad Shaneh via GitGitGadget, Feb 15, 2026
  2. 1/2 fetch: add a test for --force flagOrgad Shaneh via GitGitGadget, Feb 15, 2026
  3. 2/2 fetch: clobber existing tags with --prune-tagsOrgad Shaneh via GitGitGadget, Feb 15, 2026
  4. Orgad ShanehMar 18, 2026
  5. Junio C HamanoMar 21, 2026
  6. Orgad ShanehMar 26, 2026
  7. Orgad ShanehSep 13, 2026
  8. Junio C HamanoSep 13, 2026
  9. Orgad ShanehOct 6, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.