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

Re: [PATCH 2/2] fetch: clobber existing tags with --prune-tags

From
Orgad Shaneh <orgads@gmail.com>
Date
Mar 18, 2026, 08:27 UTC
Message-ID
<CAGHpTB+qbtrBQd23hobQqJjG1+nwkHqBP1fcYjSPvrJhWcD21g@mail.gmail.com>
In-Reply-To
<b444fa7af9f39960652209143c9845a47efd58e1.1771187016.git.gitgitgadget@gmail.com>

On Sun, Feb 15, 2026 at 10:23 PM Orgad Shaneh via GitGitGadget <gitgitgadget@gmail.com> wrote:

Show 61 quoted lines
>
> From: Orgad Shaneh <orgad.shaneh@audiocodes.com>
>
> This was documented but not implemented.
>
> In the flag description:
> prune local tags no longer on remote *and clobber changed tags*
>
> In the documentation:
> ... to prune local tags that don't exist on the remote, *and
> force-update those tags that differ*.
>
> Signed-off-by: Orgad Shaneh <orgad.shaneh@audiocodes.com>
> ---
>  builtin/fetch.c       |  2 +-
>  t/t5516-fetch-push.sh | 10 ++++++++--
>  2 files changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/builtin/fetch.c b/builtin/fetch.c
> index a3bc7e9380..c212f50b86 100644
> --- a/builtin/fetch.c
> +++ b/builtin/fetch.c
> @@ -981,7 +981,7 @@ static int update_local_ref(struct ref *ref,
>             starts_with(ref->name, "refs/tags/")) {
>                 struct ref_update_display_info *info;
>
> -               if (force || ref->force) {
> +               if (force || ref->force || prune_tags) {
>                         int r;
>
>                         r = s_update_ref("updating tag", ref, transaction, 0);
> diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
> index 31df7faf56..4d29043baf 100755
> --- a/t/t5516-fetch-push.sh
> +++ b/t/t5516-fetch-push.sh
> @@ -1092,7 +1092,7 @@ test_force_fetch_tag () {
>         tag_type_description=$1
>         tag_args=$2
>
> -       test_expect_success "fetch will not clobber an existing $tag_type_description without --force" "
> +       test_expect_success "fetch will not clobber an existing $tag_type_description without --force or --prune-tags" "
>                 mk_test testrepo heads/main &&
>                 mk_child testrepo child1 &&
>                 mk_child testrepo child2 &&
> @@ -1108,7 +1108,13 @@ test_force_fetch_tag () {
>                         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
> +                       git -C ../child1 fetch --force origin tag testTag &&
> +                       git tag $tag_args testTag HEAD &&
> +                       test_must_fail git -C ../child1 fetch origin tag testTag &&
> +                       git -C ../child1 fetch --prune-tags origin tag testTag &&
> +                       git tag $tag_args testTag HEAD^ &&
> +                       test_must_fail git -C ../child1 fetch origin tag testTag &&
> +                       git -C ../child1 -c fetch.prunetags=true fetch origin tag testTag
>                 )
>         "
>  }
> --
> gitgitgadget

Gently pinging this thread. I submitted this patch about a month ago and would appreciate any feedback once someone finds a moment to review it.

Thanks!
Previous: Orgad Shaneh via GitGitGadgetNext: Junio C Hamano
Message 4 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.