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

[BUG] git fetch fetches tags matching negative refspec

From
EEErik Cervin Edin <erik@cervined.in>
Date
Oct 12, 2022, 08:29 UTC
Message-ID
<CA+JQ7M-CN0UnHQDDDVz0kPcU1AcoL9+WFOeR8eiw_B=Yiyc-CA@mail.gmail.com>

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.

[System Info] git version: git version 2.38.0.windows.1 cpu: x86_64 built from commit: 0355083fbe5582f6d3f819afc130ed2f2375e0bd sizeof-long: 4 sizeof-size_t: 8 shell-path: /bin/sh feature: fsmonitor--daemon uname: Windows 10.0 19044 compiler info: gnuc: 12.2 libc info: no libc information available $SHELL (typically, interactive shell): C:\Users\erik\Git\usr\bin\bash.exe

[Enabled Hooks]
Next: Ævar Arnfjörð Bjarmason
Message 1 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.