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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Oct 13, 2022 at 5:31 PM Junio C Hamano <gitster@xxxxxxxxx> wrote:
>
> It indeed is confusing and might warrant some clarification, if not
> updating.
>
>  * "--tags" is equivalent to giving "refs/tags*:refs/tags*", so it
>    might be natural to expect that you can say the same thing as
>    above with "fetch $URL --tags --no-tags", but it does not work
>    that way.  Command line parser treats "--tags" and "--no-tags" as
>    if they follow the "last one wins" semantics.
>
>  * As discussed in this thread, what "--no-tags" really means is "do
>    not follow tags"; there is no way to countermand a "--no-tags"
>    earlier on the command line to say "earlier we said do not
>    follow, but we changed our mind.  Please do follow tags".

Thank you for the clarification.

What follows is a small write-up of my problem for posterity and
in-case someone else finds it useful.

What I'm trying to achieve is by default excluding a set of tags auto
generated build tags from being fetched, unless I specifically fetch
them.

Something akin to this works
  [remote "origin"]
      url = git@xxxxxxxxxx:git/git.git
      fetch = +refs/heads/*:refs/remotes/origin/*
      fetch = ^refs/tags/v2.9.*
      tagOpt = --no-tags

This lets me
  git fetch
  git fetch origin master
without fetching tags matching the negative refspec, as expected. As
well as override it through
  git fetch origin '+refs/tags/v2.9.0*:refs/tags/v2.9.0*'
which isn't super friendly to write but does the job


Earlier in the thread, I was under the impression --tags worked better
than --no-tags. It seemed it would avoid clobbering tags. I don't
think that's actually the case (they both clobber?) and it turned out
it wouldn't exclude refs if I was fetching a specific ref, ie
  git fetch origin master
would also fetch the tags I didn't want. So --no-tags it is



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux