{"thread":{"id":"30226","subject":"prevent push of irrelevant tags","startedAt":"2012-04-12T19:47:31Z","lastAt":"2012-04-12T20:45:22Z","messageCount":4,"participants":["Rolf Leggewie","Junio C Hamano","Andreas Schwab"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"189133","messageId":"4F873153.9060004@rolf.leggewie.biz","threadId":"30226","inReplyTo":null,"subject":"prevent push of irrelevant tags","fromName":"Rolf Leggewie","fromEmail":"foss@rolf.leggewie.biz","sentAt":"2012-04-12T19:47:31Z","receivedAt":"2012-04-12T19:47:31Z","isPatch":false,"sender":{"key":"foss@rolf.leggewie.biz","avatar":null},"body":"Hello,\n\nI just ran into the situation that \"git push --tags\" pushed tags to the\nremote repo that point to commits that do not exist there.  How can this\nhappen?  Well, in my case it was because I have more than one remote\nrepo with non-overlapping tags and they cross-polluted each other. \nAnother possibility that comes to mind is local tags for\nwork-in-progress commits, for example.\n\nGit has the information to know that tag X will be useless in repo Y\nbecause the commit Z it points to does not exist in Y.  It would be nice\nif \"git push --tags\" did the right thing and excluded irrelevant tags\nwhen pushing.  Thank you for your attention and thank you for git!\n\nRegards\n\nRolf\n"},{"id":"189134","messageId":"7v1uns67f4.fsf@alter.siamese.dyndns.org","threadId":"30226","inReplyTo":"4F873153.9060004@rolf.leggewie.biz","subject":"Re: prevent push of irrelevant tags","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-04-12T20:07:11Z","receivedAt":"2012-04-12T20:07:11Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Rolf Leggewie <foss@rolf.leggewie.biz> writes:\n\n> I just ran into the situation that \"git push --tags\" pushed tags to the\n> remote repo that point to commits that do not exist there.  How can this\n> happen?\n\nThe \"--tags\" option is to request to push every ref under refs/tags/\nhierarchy, so the answer is \"because the user asked to\".\n\n> Git has the information to know...\n\nNo, it doesn't.  \n\n>  that tag X will be useless in repo Y\n> because the commit Z it points to does not exist in Y.\n\nThink of a case where:\n\n 1. You have cloned from your origin.\n\n 2. You built history on top of your 'master' branch, and pushed the\n    result. The 'master' at your origin now points at this commit.\n\n 3. Somebody working on the project cloned from the same origin, built\n    some history, and pushed the result.  The 'master' at your origin is\n    again updated to point at this commit (which is a descendant of the\n    commit you made in #2).\n\n 4. You tagged the tip of your 'master' as v1.0.\n\n 5. You give the magic \"--relevant-tags-only\" option to your \"git push\".\n\nNow what happens?\n\nThe only two things your \"git push\" knows are that your origin does not\nhave v1.0 tag, and that its 'master' branch points at the commit created\nby somebody else at #3.  Most importantly, it does not have the history\nleading to this commit (\"push\" never fetches); it does not have a way to\ntell if it is a descendant of commit you created in #2.  In other words,\nthe magic \"--relevant-tags-only\" is fundamentally flawed as a concept.\n"},{"id":"189137","messageId":"m2bomwy9iz.fsf@igel.home","threadId":"30226","inReplyTo":"4F873153.9060004@rolf.leggewie.biz","subject":"Re: prevent push of irrelevant tags","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2012-04-12T20:34:12Z","receivedAt":"2012-04-12T20:34:12Z","isPatch":false,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"Rolf Leggewie <foss@rolf.leggewie.biz> writes:\n\n> I just ran into the situation that \"git push --tags\" pushed tags to the\n> remote repo that point to commits that do not exist there.  How can this\n> happen?\n\nA tag is just a ref like any other.\n\n> Git has the information to know that tag X will be useless in repo Y\n> because the commit Z it points to does not exist in Y.\n\nIt is not useless.  After you pushed the tag the commit Z it points to\nexists now in Y as well.\n\nAndreas.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5\n\"And now for something completely different.\"\n"},{"id":"189141","messageId":"4F873EE2.5090203@rolf.leggewie.biz","threadId":"30226","inReplyTo":"7v1uns67f4.fsf@alter.siamese.dyndns.org","subject":"Re: prevent push of irrelevant tags","fromName":"Rolf Leggewie","fromEmail":"foss@rolf.leggewie.biz","sentAt":"2012-04-12T20:45:22Z","receivedAt":"2012-04-12T20:45:22Z","isPatch":false,"sender":{"key":"foss@rolf.leggewie.biz","avatar":null},"body":"Hamano-San,\n\nthank you very much for the ultra-quick reply and your explanation.\n\nOn 13.04.2012 04:07, Junio C Hamano wrote:\n>> Git has the information to know...\n> \n> No, it doesn't.  \n> \n>>  that tag X will be useless in repo Y\n>> because the commit Z it points to does not exist in Y.\n> \n> Think of a case where:\n\nI am only a simple user so I hope you will not be angry with me if I\nmisunderstand you.  I believe you are saying that \"git push\" does not\nhave the necessary information which I take your word for.  But git\nitself surely should know if commit Z is available from repo Y or am I\nmistaken?  For example I can do \"git log repoY:master|grep $ZcommitID\".\n That would return empty if the master branch at repoY didn't have\ninformation about Z*.\n\nThank you for bearing with me.\n\nRegards\n\nRolf\n\n\n* Of course, it's possible that Z is not part of master but another\n  branch at Y.\n"}]}