From: Karen Arutyunov <karen@codesynthesis.com>
To: git@vger.kernel.org
Cc: Boris Kolpackov <boris@codesynthesis.com>
Subject: Updating local tags: bugs and general feasibility
Date: Wed, 19 Jun 2019 16:25:17 +0300 [thread overview]
Message-ID: <981804d3-1485-f100-7b0e-8f1bc58226a5@codesynthesis.com> (raw)
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
reply other threads:[~2019-06-19 13:25 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=981804d3-1485-f100-7b0e-8f1bc58226a5@codesynthesis.com \
--to=karen@codesynthesis.com \
--cc=boris@codesynthesis.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).