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

Re: [BUG] git fetch fetches tags matching negative refspec

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Oct 12, 2022, 09:11 UTC
Message-ID
<221012.86mta1mmli.gmgdl@evledraar.gmail.com>
In-Reply-To
<CA+JQ7M-CN0UnHQDDDVz0kPcU1AcoL9+WFOeR8eiw_B=Yiyc-CA@mail.gmail.com>
On Wed, Oct 12 2022, Erik Cervin Edin wrote:
Show 41 quoted lines
> Thank you for filling out a Git bug report!
> Please answer the following questions to help us understand your issue.
>
> What did you do before the bug happened? (Steps to reproduce your issue)
>
> Delete all v2.9.* tags
>   git tag | grep ^v2.9.* | xargs git tag -d
>
> Change standard the standard fetch configuration
> [remote "origin"]
>     url = git@github.com:git/git.git
>     fetch = +refs/heads/*:refs/remotes/origin/*
>
> By adding a negative respec for tags matching v2.9.*
> [remote "origin"]
>     url = git@github.com:git/git.git
>     fetch = +refs/heads/*:refs/remotes/origin/*
>     fetch = ^refs/tags/v2.9.*
>
> run
>   git fetch
>
> What did you expect to happen? (Expected behavior)
>
> To exclude tags matchings v2.9*, just like when running git fetch --tags
>
> What happened instead? (Actual behavior)
>
> Without specifying git fetch --tags, tags matching the negative
> refspec are still fetched
>
> What's different between what you expected and what actually happened?
>
> The negative refspec appears to be ignored or overruled when running
> git fetch without the --tags flag
>
> Anything else you want to add:
> I love git, thank you! ♥
>
> Please review the rest of the bug report below.
> You can delete any lines you don't wish to share.

I haven't had time to try this, but I believe this isn't a bug, it's just that you didn't supply --no-tags.

"But I want some tags!", yes, that's not what --no-tags does, see the 2nd paragraph of the DESCRIPTION section of "git-fetch".

I.e. it got stuff you asked for, but also tags pointing at the main history, --no-tags will stop that, at which point you can *also* fetch tags, just with the refspec.

Previous: Erik Cervin EdinNext: Erik Cervin Edin
Message 2 of 7 in “[BUG] git fetch fetches tags matching negative refspec”
  1. Erik Cervin EdinOct 12, 2022
  2. Ævar Arnfjörð BjarmasonOct 12, 2022
  3. Erik Cervin EdinOct 12, 2022
  4. Ævar Arnfjörð BjarmasonOct 12, 2022
  5. Erik Cervin EdinOct 13, 2022
  6. Junio C HamanoOct 13, 2022
  7. Erik Cervin EdinOct 18, 2022

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.