Thread (4 messages) 4 messages, 3 authors, 2018-04-26

Re: Fetching tags overwrites existing tags

From: Jacob Keller <hidden>
Date: 2018-04-25 01:30:14

On Tue, Apr 24, 2018 at 5:52 PM, Junio C Hamano [off-list ref] wrote:
Wink Saville [off-list ref] writes:
quoted
Ideally I would have liked the tags fetched from gbenchmark to have a prefix
of gbenchmark/, like the branches have, maybe something like:

$ git fetch --tags gbenchmark
...
 * [new branch]      v2              -> gbenchmark/v2
 * [new tag]         v0.0.9          -> gbenchmark/v0.0.9
 * [new tag]         v0.1.0          -> gbenchmark/v0.1.0
 * [new tag]         v1.0.0          -> gbenchmark/v1.0.0
 * [new tag]         v1.1.0          -> gbenchmark/v1.1.0
 * [new tag]         v1.2.0          -> gbenchmark/v1.2.0
 * [new tag]         v1.3.0          -> gbenchmark/v1.3.0
 * [new tag]         v1.4.0          -> gbenchmark/v1.4.0
The tag namespace (refs/tags/) is considered a shared resource (I am
not saying that that is the only valid world model---I am merely
explaining why things are like they are), hence the auto-following
tags will bring them to refs/tags/ (and I do not think there is no
way to configure auto-following to place them elsewhere).

But you could configure things yourself.

    $ git init victim && cd victim
    $ git remote add origin ../git.git
    $ git config --add remote.origin.fetch \
      "+refs/tags/*:refs/remote-tags/origin/*"
    $ tail -n 4 .git/config
    [remote "origin"]
        url = ../git.git/
        fetch = +refs/heads/*:refs/remotes/origin/*
        fetch = +refs/tags/*:refs/remote-tags/origin/*
    $ git fetch --no-tags

The "--no-tags" option serves to decline the auto-following tags to
refs/tags/ hierarchy; once your repository is configured this way,
your initial and subsequent "git fetch" will copy refs it finds in
refs/tags/ hierarchy over there to your refs/remote-tags/origin/
hierarchy locally.
It should be noted, that remote-tags would not be integrated into "git
tag" or many other places in git commands, so it may be significantly
less visible.

Thanks,
Jake
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help