* prevent push of irrelevant tags
@ 2012-04-12 19:47 Rolf Leggewie
2012-04-12 20:07 ` Junio C Hamano
2012-04-12 20:34 ` Andreas Schwab
0 siblings, 2 replies; 4+ messages in thread
From: Rolf Leggewie @ 2012-04-12 19:47 UTC (permalink / raw)
To: git
Hello,
I just ran into the situation that "git push --tags" pushed tags to the
remote repo that point to commits that do not exist there. How can this
happen? Well, in my case it was because I have more than one remote
repo with non-overlapping tags and they cross-polluted each other.
Another possibility that comes to mind is local tags for
work-in-progress commits, for example.
Git has the information to know that tag X will be useless in repo Y
because the commit Z it points to does not exist in Y. It would be nice
if "git push --tags" did the right thing and excluded irrelevant tags
when pushing. Thank you for your attention and thank you for git!
Regards
Rolf
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: prevent push of irrelevant tags
2012-04-12 19:47 prevent push of irrelevant tags Rolf Leggewie
@ 2012-04-12 20:07 ` Junio C Hamano
2012-04-12 20:45 ` Rolf Leggewie
2012-04-12 20:34 ` Andreas Schwab
1 sibling, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2012-04-12 20:07 UTC (permalink / raw)
To: Rolf Leggewie; +Cc: git
Rolf Leggewie <foss@rolf.leggewie.biz> writes:
> I just ran into the situation that "git push --tags" pushed tags to the
> remote repo that point to commits that do not exist there. How can this
> happen?
The "--tags" option is to request to push every ref under refs/tags/
hierarchy, so the answer is "because the user asked to".
> Git has the information to know...
No, it doesn't.
> that tag X will be useless in repo Y
> because the commit Z it points to does not exist in Y.
Think of a case where:
1. You have cloned from your origin.
2. You built history on top of your 'master' branch, and pushed the
result. The 'master' at your origin now points at this commit.
3. Somebody working on the project cloned from the same origin, built
some history, and pushed the result. The 'master' at your origin is
again updated to point at this commit (which is a descendant of the
commit you made in #2).
4. You tagged the tip of your 'master' as v1.0.
5. You give the magic "--relevant-tags-only" option to your "git push".
Now what happens?
The only two things your "git push" knows are that your origin does not
have v1.0 tag, and that its 'master' branch points at the commit created
by somebody else at #3. Most importantly, it does not have the history
leading to this commit ("push" never fetches); it does not have a way to
tell if it is a descendant of commit you created in #2. In other words,
the magic "--relevant-tags-only" is fundamentally flawed as a concept.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: prevent push of irrelevant tags
2012-04-12 19:47 prevent push of irrelevant tags Rolf Leggewie
2012-04-12 20:07 ` Junio C Hamano
@ 2012-04-12 20:34 ` Andreas Schwab
1 sibling, 0 replies; 4+ messages in thread
From: Andreas Schwab @ 2012-04-12 20:34 UTC (permalink / raw)
To: Rolf Leggewie; +Cc: git
Rolf Leggewie <foss@rolf.leggewie.biz> writes:
> I just ran into the situation that "git push --tags" pushed tags to the
> remote repo that point to commits that do not exist there. How can this
> happen?
A tag is just a ref like any other.
> Git has the information to know that tag X will be useless in repo Y
> because the commit Z it points to does not exist in Y.
It is not useless. After you pushed the tag the commit Z it points to
exists now in Y as well.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: prevent push of irrelevant tags
2012-04-12 20:07 ` Junio C Hamano
@ 2012-04-12 20:45 ` Rolf Leggewie
0 siblings, 0 replies; 4+ messages in thread
From: Rolf Leggewie @ 2012-04-12 20:45 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
Hamano-San,
thank you very much for the ultra-quick reply and your explanation.
On 13.04.2012 04:07, Junio C Hamano wrote:
>> Git has the information to know...
>
> No, it doesn't.
>
>> that tag X will be useless in repo Y
>> because the commit Z it points to does not exist in Y.
>
> Think of a case where:
I am only a simple user so I hope you will not be angry with me if I
misunderstand you. I believe you are saying that "git push" does not
have the necessary information which I take your word for. But git
itself surely should know if commit Z is available from repo Y or am I
mistaken? For example I can do "git log repoY:master|grep $ZcommitID".
That would return empty if the master branch at repoY didn't have
information about Z*.
Thank you for bearing with me.
Regards
Rolf
* Of course, it's possible that Z is not part of master but another
branch at Y.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-04-12 20:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-12 19:47 prevent push of irrelevant tags Rolf Leggewie
2012-04-12 20:07 ` Junio C Hamano
2012-04-12 20:45 ` Rolf Leggewie
2012-04-12 20:34 ` Andreas Schwab
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.