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

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

From
EEErik Cervin Edin <erik@cervined.in>
Date
Oct 13, 2022, 08:15 UTC
Message-ID
<CA+JQ7M-YptXOT0jynaT3Lwka9cR3P-WFLeh7R1U=gEz+86Q-sg@mail.gmail.com>
In-Reply-To
<221013.865ygomybw.gmgdl@evledraar.gmail.com>

On Thu, Oct 13, 2022 at 1:11 AM Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:

Show 22 quoted lines
>
>
> On Wed, Oct 12 2022, Erik Cervin Edin wrote:
>
> > On Wed, Oct 12, 2022 at 11:13 AM Ævar Arnfjörð Bjarmason
> > <avarab@gmail.com> wrote:
> >> 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.
> > I tried but
> >   git fetch --no-tags
> > with negative refspec did not fetch any tags.
> >   git fetch --tags
> > does.
>
> Because your refspec doesn't include refs/tags/*:, try e.g.:
>
>         git fetch https://github.com/git/git.git 'refs/tags/*:refs/tags/*' --no-tags --dry-run
>
> That's what "--no-tags", i.e. it's per-se (and confusingly) nothing to
> do with whether you get tags or not, it's to do with whether we to tag
> following.

Kind of, adding the tags refspec with --no-tags excludes tags matching the negative refspec but it also clobbers existing tags.

Show 6 quoted lines
>
> > I'm going to set
> >   git config remote.origin.tagopt --tags
> > and then that's going to do what I want.
>
> Isn't that going to give you also the tags you don't want?
No, it excludes them fine. It also doesn't clobber which fits my use-case best
Previous: Ævar Arnfjörð BjarmasonNext: Junio C Hamano
Message 5 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.