Re: [BUG] git fetch fetches tags matching negative refspec
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Oct 12, 2022, 23:09 UTC
- Message-ID
- <221013.865ygomybw.gmgdl@evledraar.gmail.com>
- In-Reply-To
- <CA+JQ7M-y9d=c3GbpAs+Y4qtimtVs9oQ6BU1YL8nmFmF=rZxKag@mail.gmail.com>
On Wed, Oct 12 2022, Erik Cervin Edin wrote:
Show 10 quoted lines
> 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.
> 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?