Re: Fetching tags overwrites existing tags
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Apr 27, 2018, 19:46 UTC
- Message-ID
- <CACBZZX7HFnEMD8PKWj0c7VWqv=yeYCXYJjy-5YPZnF_pJAy0jw@mail.gmail.com>
- In-Reply-To
- <CAKk8isrAmWOdioJe2CdY+2F_AzKxcTGwd+kBsrAmGx-U=ZHGgA@mail.gmail.com>
On Tue, Apr 24, 2018 at 9:57 PM, Wink Saville <wink@saville.com> wrote:
> If have a repository with a tag "v1.0.0" and I add a remote repository > which also has a tag "v1.0.0" tag is overwritten.
I feel like this thread has gotten somewhat side-tracked by the valid discussion about whether we should have remote tracking tags, but the much easier thing to fix is that the "+" prefix for refs/tags/* means nothing.
I noticed this when working on fetch.pruneTags in the last release, but didn't dig further.
I.e. if you clone git.git and update "master" and a tag:
$ git fetch origin 'refs/heads/*:refs/heads/*' --dry-run From github.com:git/git ! [rejected] master -> master (non-fast-forward) $ git fetch origin '+refs/heads/*:refs/heads/*' --dry-run From github.com:git/git + 969e05fae2...1f1cddd558 master -> master (forced update)
Here "+" does the right thing, but then:
$ git fetch origin 'refs/tags/*:refs/tags/*' --dry-run From github.com:git/git t [tag update] v2.17.0 -> v2.17.0 $ git fetch origin '+refs/tags/*:refs/tags/*' --dry-run From github.com:git/git t [tag update] v2.17.0 -> v2.17.0
Here the former shouldn't be clobbering the existing tag.