Updating local tags: bugs and general feasibility

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

 



Hello,

I'm trying to configure my git client to update local tags with the remote ones. Prior to git 2.20 the following option in ~/.gitconfig did the job:

[remote "origin"]
	tagopt = --tags

So the following commands worked as expected and the local tag gets updated:

# Create remote repository.
#
$ git init foo.git
$ touch foo.git/README
$ git -C foo.git/ add README
$ git -C foo.git/ commit -m "Release 1.0.0"
$ git -C foo.git/ tag -a -m "Tag version 1.0.0" "v1.0.0"

# Create local repository.
#
$ git clone foo.git

# Update remote repository moving the tag.
#
$ echo "TODO" >foo.git/README
$ git -C foo.git/ commit -a -m "Revision 1.0.0+1"
$ git -C foo.git/ tag -a -f -m "Tag version 1.0.0+1" "v1.0.0"
Updated tag 'v1.0.0' (was 3b773b1)

# Update local repository moving the tag.
#
$ git -C foo pull
...
t [tag update]      v1.0.0     -> v1.0.0
...

Staring with git 2.20 the last command expectedly (according to the git-fetch documentation) fails:

$ git -C foo pull
...
 ! [rejected]        v1.0.0     -> v1.0.0  (would clobber existing tag)

Replacing the tagopt option in ~/.gitconfig with the following helps and the above git-pull command succeeds:

[remote "origin"]
	fetch = +refs/tags/*:refs/tags/*

(This approach is recommended by several stackoverflow answers and
 studying git documentation gives the impression that it is the proper
 way to accomplish this.)

However, starting with git 2.21 in the presence of this configuration option I'm no longer able to clone any repository that contains tags:

$ git clone foo.git
Cloning into 'foo'...
done.
fatal: multiple updates for ref 'refs/tags/v1.0.0' not allowed
fatal: the remote end hung up unexpectedly

But still can succeed by running:

$ git init foo
$ git -C foo remote add origin ../foo.git
$ git -C foo fetch
...
>From ../foo
 * [new tag]         v1.0.0     -> v1.0.0
 * [new branch]      master     -> origin/master
$ git -C foo checkout master

Note that the git version at the tip of the master branch (a6a95cd) behaves the same way.

Is it a bug or am I somehow misusing this fetch configuration option?

Yet another strange thing I've noticed (that also happens for git versions prior to 2.20) is that removing a remote tag also removes the local tag in the presence of this fetch configuration option:

$ git -C foo tag
v1.0.0
$ git -C foo push origin :v1.0.0
$ git -C foo tag

Is it a bug or does the fetch option somehow also affects the push operation?

The more general question: is overwriting tags, while generally not recommended, nevertheless a valid approach for some sensible use cases (e.g., a tag that always refers to the latest stable version or some such) or is this not going to be supported long term and we are on our own trying to accomplish this?

If the approach is considered to be valid, are there any plans to allow configuring a remote git repository in a way that when it is pulled/fetched, the local tags get updated without any additional configuration effort from the user?

Thanks,
Karen



[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