{"thread":{"id":"17091","subject":"Lightweight tag ?","startedAt":"2009-01-11T18:44:30Z","lastAt":"2009-01-12T20:50:17Z","messageCount":8,"participants":["Francis Moreau","Junio C Hamano","Michael J Gruber"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"99976","messageId":"38b2ab8a0901111044x5db21d74i25ff7a26bb702a5d@mail.gmail.com","threadId":"17091","inReplyTo":null,"subject":"Lightweight tag ?","fromName":"Francis Moreau","fromEmail":"francis.moro@gmail.com","sentAt":"2009-01-11T18:44:30Z","receivedAt":"2009-01-11T18:44:30Z","isPatch":false,"sender":{"key":"francis.moro@gmail.com","avatar":null},"body":"Hello,\n\nI'm puzzling about the lightweight.\n\nMy problem is that I don't see their point !\n\nThey behave the same way like the annotated tags: when pushing to a\nrepo the lightweight tags are pushed as well, and pulling from a repo\nwith lightweight tags give the same results (all of this with the\n--tags switch).\n\nI would have thought that these kind of tags are local to a\nrepository but it doesn't look so.\n\nSo could anybody give me a useful use case for lightweight tags ?\n\nAnd how can I create local tags ?\n\nThanks\n-- \nFrancis\n"},{"id":"100007","messageId":"7v63klsgf5.fsf@gitster.siamese.dyndns.org","threadId":"17091","inReplyTo":"38b2ab8a0901111044x5db21d74i25ff7a26bb702a5d@mail.gmail.com","subject":"Re: Lightweight tag ?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-01-11T21:04:30Z","receivedAt":"2009-01-11T21:04:30Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Francis Moreau\" <francis.moro@gmail.com> writes:\n\n> My problem is that I don't see their point !\n>\n> They behave the same way like the annotated tags: when pushing to a\n> repo the lightweight tags are pushed as well, and pulling from a repo\n> with lightweight tags give the same results (all of this with the\n> --tags switch).\n\nDon't use explicit --tags blindly.  It says \"no matter what kind of tag,\ntransfer everything under refs/tags\".  Otherwise you won't see a\ndifference.\n"},{"id":"100089","messageId":"m2bpucnas2.fsf@gmail.com","threadId":"17091","inReplyTo":"7v63klsgf5.fsf@gitster.siamese.dyndns.org","subject":"Re: Lightweight tag ?","fromName":"Francis Moreau","fromEmail":"francis.moro@gmail.com","sentAt":"2009-01-12T09:17:33Z","receivedAt":"2009-01-12T09:17:33Z","isPatch":false,"sender":{"key":"francis.moro@gmail.com","avatar":null},"body":"Hello,\n\nJunio C Hamano <gitster@pobox.com> writes:\n\n> Don't use explicit --tags blindly.  It says \"no matter what kind of tag,\n> transfer everything under refs/tags\".  Otherwise you won't see a\n> difference.\n\nWell:\n\n\t$ git --version\n\tgit version 1.6.0.4\n\t$ mkdir test-tag\n\t$ cd test-tag/\n\t$ date > A\n\t$ git init\n\tInitialized empty Git repository in\n\t/home/fmoreau/tmp/git/test-tag/.git/\n\t$ git add .\n\t$ git commit -a -s -m \"Init\"\n\tCreated initial commit be8750e: Init\n\t 1 files changed, 1 insertions(+), 0 deletions(-)\n\t create mode 100644 A\n\t$ cd ..\n\t$ git clone --bare test-tag test-tag.git\n\tInitialized empty Git repository in /home/fmoreau/tmp/git/test-tag.git/\n\t$ cd test-tag\n\t$ git tag light\n\t\n\t$ git tag -a -m \"Annoted tag\" annoted\n\t$ git push ../test-tag.git\n\tEverything up-to-date\n\t$ git push --tags ../test-tag.git\n\tCounting objects: 1, done.\n\tWriting objects: 100% (1/1), 166 bytes, done.\n\tTotal 1 (delta 0), reused 0 (delta 0)\n\tUnpacking objects: 100% (1/1), done.\n\tTo ../test-tag.git\n\t * [new tag]         annoted -> annoted\n\t * [new tag]         light -> light\n\nIt looks like they're no difference for git-push...\n\nThat said the documentation about this is rather cryptic IMHO:\n\n,----[ man git-push ]\n| \t--tags\n| \t    All refs under $GIT_DIR/refs/tags are pushed, in\n| \t    addition to refspecs explicitly listed on the command\n| \t    line.\n`----\n\n>From a user point of view, the word lightweight is missing here. Why\nnot simply saying:\n\n,----\n| All kind of tags are pushed with this option _otherwise_ only annoted\n| tags are pushed\n`----\n\nthanks\n-- \nFrancis\n"},{"id":"100116","messageId":"496B3DA8.1040308@drmicha.warpmail.net","threadId":"17091","inReplyTo":"m2bpucnas2.fsf@gmail.com","subject":"Re: Lightweight tag ?","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-01-12T12:55:04Z","receivedAt":"2009-01-12T12:55:04Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Francis Moreau venit, vidit, dixit 01/12/09 10:17:\n> Hello,\n> \n> Junio C Hamano <gitster@pobox.com> writes:\n> \n>> Don't use explicit --tags blindly.  It says \"no matter what kind of tag,\n>> transfer everything under refs/tags\".  Otherwise you won't see a\n>> difference.\n> \n> Well:\n> \n> \t$ git --version\n> \tgit version 1.6.0.4\n> \t$ mkdir test-tag\n> \t$ cd test-tag/\n> \t$ date > A\n> \t$ git init\n> \tInitialized empty Git repository in\n> \t/home/fmoreau/tmp/git/test-tag/.git/\n> \t$ git add .\n> \t$ git commit -a -s -m \"Init\"\n> \tCreated initial commit be8750e: Init\n> \t 1 files changed, 1 insertions(+), 0 deletions(-)\n> \t create mode 100644 A\n> \t$ cd ..\n> \t$ git clone --bare test-tag test-tag.git\n> \tInitialized empty Git repository in /home/fmoreau/tmp/git/test-tag.git/\n> \t$ cd test-tag\n> \t$ git tag light\n> \t\n> \t$ git tag -a -m \"Annoted tag\" annoted\n> \t$ git push ../test-tag.git\n> \tEverything up-to-date\n> \t$ git push --tags ../test-tag.git\n> \tCounting objects: 1, done.\n> \tWriting objects: 100% (1/1), 166 bytes, done.\n> \tTotal 1 (delta 0), reused 0 (delta 0)\n> \tUnpacking objects: 100% (1/1), done.\n> \tTo ../test-tag.git\n> \t * [new tag]         annoted -> annoted\n> \t * [new tag]         light -> light\n> \n> It looks like they're no difference for git-push...\n> \n> That said the documentation about this is rather cryptic IMHO:\n> \n> ,----[ man git-push ]\n> | \t--tags\n> | \t    All refs under $GIT_DIR/refs/tags are pushed, in\n> | \t    addition to refspecs explicitly listed on the command\n> | \t    line.\n> `----\n> \n> From a user point of view, the word lightweight is missing here. Why\n> not simply saying:\n> \n> ,----\n> | All kind of tags are pushed with this option _otherwise_ only annoted\n> | tags are pushed\n> `----\n\nYour test above confirms that the description is correct and nothing is\nmissing. \"git push\" pushes explicitly listed refspecs (or : as a\ndefault). It pushes tags (light and heavy) when asked to.\n\n\"git pull\" pulls tags if they can be reached from heads which are\npulled. It pulls all tags only when asked to.\n\nIn fact, the automatic following of tags (if they can be reached...)\ndepends on the transport, because typically you want to clone everything\nif you clone locally but don't want all tags if you clone/pull from a\nremote. There is also a config \"tagopt\" for overriding this. It's\nmentioned but not really explained in \"git tag\"'s man page.\n\nSo, \"non-local\" tags are the ones which can be reached from heads which\nyou pull, and local ones are the others. I don't think lightweight tags\nare more local than tag objects (please correct me if I'm wrong; I think\nthis needs more doc). It's just that the latter reside in the object db\nstore whereas the former are simple refs under refs/tags.\n\nMichael\n"},{"id":"100123","messageId":"38b2ab8a0901120556x279f320oe693304dd2452050@mail.gmail.com","threadId":"17091","inReplyTo":"496B3DA8.1040308@drmicha.warpmail.net","subject":"Re: Lightweight tag ?","fromName":"Francis Moreau","fromEmail":"francis.moro@gmail.com","sentAt":"2009-01-12T13:56:49Z","receivedAt":"2009-01-12T13:56:49Z","isPatch":false,"sender":{"key":"francis.moro@gmail.com","avatar":null},"body":"On Mon, Jan 12, 2009 at 1:55 PM, Michael J Gruber\n<git@drmicha.warpmail.net> wrote:\n> Your test above confirms that the description is correct and nothing is\n> missing. \"git push\" pushes explicitly listed refspecs (or : as a\n> default). It pushes tags (light and heavy) when asked to.\n>\n\nSo do you mean that the only way I have for pushing annoted tags only is\nto do:\n\n   $ git push origin refs/tags/annoted\n\nThat's not what Junio said:\n\n   Don't use explicit --tags blindly.  It says \"no matter what kind of tag,\n   transfer everything under refs/tags\".  Otherwise you won't see a\n   difference.\n\nSo I interpret this like don't use --tags otherwise lightweight and annoted tags\nare the same.\n\n> \"git pull\" pulls tags if they can be reached from heads which are\n> pulled. It pulls all tags only when asked to.\n>\n\n[...]\n\n> So, \"non-local\" tags are the ones which can be reached from heads which\n> you pull, and local ones are the others.\n\nSo I can't create a local tag on public heads (the ones I'm pushing\nout), can I ?\n\n> I don't think lightweight tags are more local than tag objects\n> (please correct me if I'm wrong; I think this needs more doc)\n\nPerhaps it needs documents which are more user friendly: I don't know where\nthe 'lightweight' word is coming from (perhaps from the implementation) but\nI would expect that the _local_ term appears in the git-tag manual.\n\n> It's just that the latter reside in the object db\n> store whereas the former are simple refs under refs/tags.\n\nThat's implementation detail...\n\nI just need to create a local tag where I'm sure it won't be seen by others\nwhatever the git operations I'm doing, normally a simple \"git tag\" switch\nshould be enough...\n\nthanks.\n-- \nFrancis\n"},{"id":"100126","messageId":"496B59A3.2080507@drmicha.warpmail.net","threadId":"17091","inReplyTo":"38b2ab8a0901120556x279f320oe693304dd2452050@mail.gmail.com","subject":"Re: Lightweight tag ?","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-01-12T14:54:27Z","receivedAt":"2009-01-12T14:54:27Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Francis Moreau venit, vidit, dixit 01/12/09 14:56:\n> On Mon, Jan 12, 2009 at 1:55 PM, Michael J Gruber\n> <git@drmicha.warpmail.net> wrote:\n>> Your test above confirms that the description is correct and nothing is\n>> missing. \"git push\" pushes explicitly listed refspecs (or : as a\n>> default). It pushes tags (light and heavy) when asked to.\n>>\n> \n> So do you mean that the only way I have for pushing annoted tags only is\n> to do:\n> \n>    $ git push origin refs/tags/annoted\n\nYou could use the equivalent, more user friendly \"git push origin tag\nannoted\".\n\n> That's not what Junio said:\n> \n>    Don't use explicit --tags blindly.  It says \"no matter what kind of tag,\n>    transfer everything under refs/tags\".  Otherwise you won't see a\n>    difference.\n> \n> So I interpret this like don't use --tags otherwise lightweight and annoted tags\n> are the same.\n\nI don't see a difference between lightweight tags and tag objects\nregarding the question of automatic tag following, see my parenthetical\nrequest for correction (below) in case I'm wrong.\n\n>> \"git pull\" pulls tags if they can be reached from heads which are\n>> pulled. It pulls all tags only when asked to.\n>>\n> \n> [...]\n> \n>> So, \"non-local\" tags are the ones which can be reached from heads which\n>> you pull, and local ones are the others.\n> \n> So I can't create a local tag on public heads (the ones I'm pushing\n> out), can I ?\n> \n>> I don't think lightweight tags are more local than tag objects\n>> (please correct me if I'm wrong; I think this needs more doc)\n> \n> Perhaps it needs documents which are more user friendly: I don't know where\n> the 'lightweight' word is coming from (perhaps from the implementation) but\n> I would expect that the _local_ term appears in the git-tag manual.\n\nIt's the other way round. \"lightweight\" is in the first few lines of the\nman, \"local\" nowhere. In fact I don't see it anywhere in the docs.\n\n>> It's just that the latter reside in the object db\n>> store whereas the former are simple refs under refs/tags.\n> \n> That's implementation detail...\n> \n> I just need to create a local tag where I'm sure it won't be seen by others\n> whatever the git operations I'm doing, normally a simple \"git tag\" switch\n> should be enough...\n\nTaking \"whatever\" literally this is impossible, of course.\n\nTaking it /cum grano salis/ it's still impossible within the same repo:\nIf others have read access they can \"ls-remote\" and \"fetch\" happily what\nthey want. The sane and easy way is to use a private repo for your local\nwork and all your \"local tags\", then to push to a public (i.e.\npublically readable) repo those branches and tags which you want to be seen.\n\nAre you a Mercurial user by any chance? \"hg tag -l\" creates local tags\nwhich are stored in an unversioned, private file, whereas \"hg tag\"\ncreates (and commits) a tag entry in a versioned file, which is the\nsource of some confusion and problems with hg tags (\"hg co sometag\" does\nnot contain sometag etc.). Maybe you want the behaviour of \"hg tag -l\"?\n\nCheers,\nMichael\n"},{"id":"100989","messageId":"7vzlhwgv3e.fsf@gitster.siamese.dyndns.org","threadId":"17091","inReplyTo":"496B59A3.2080507@drmicha.warpmail.net","subject":"Re: Lightweight tag ?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-01-12T19:52:53Z","receivedAt":"2009-01-12T19:52:53Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michael J Gruber <git@drmicha.warpmail.net> writes:\n\n>> That's not what Junio said:\n>> \n>>    Don't use explicit --tags blindly.  It says \"no matter what kind of tag,\n>>    transfer everything under refs/tags\".  Otherwise you won't see a\n>>    difference.\n>> \n>> So I interpret this like don't use --tags otherwise lightweight and annoted tags\n>> are the same.\n>\n> I don't see a difference between lightweight tags and tag objects\n> regarding the question of automatic tag following, see my parenthetical\n> request for correction (below) in case I'm wrong.\n\nIt was me who was confused on two points.\n\n (1) push does not do autofollow and you always have to be explicit\n     (including saying \"--tags\" which is to push all refs/tags/*); I\n     somehow thought the question was about fetch;\n\n (2) if you explicitly ask to fetch tags, there won't be any difference\n     (which was my \"don't say --tags explicitly because you won't see a\n     difference if you did so\").\n\n     On the other hand, the autofollowing during the fetch originally\n     followed only annotated tags (it was partly by design, so that people\n     can use lightweight tags for local stuff without worrying about\n     contaminating others' tag namespace with many of them) and I somehow\n     thought this was still the case.\n\n     But it is not the case anymore since 6c96c0f (git-fetch: follow\n     lightweight tags as well, 2006-11-18).\n\nSo, sorry for the noise.\n"},{"id":"100158","messageId":"m2r638p7ue.fsf@gmail.com","threadId":"17091","inReplyTo":"496B59A3.2080507@drmicha.warpmail.net","subject":"Re: Lightweight tag ?","fromName":"Francis Moreau","fromEmail":"francis.moro@gmail.com","sentAt":"2009-01-12T20:50:17Z","receivedAt":"2009-01-12T20:50:17Z","isPatch":false,"sender":{"key":"francis.moro@gmail.com","avatar":null},"body":"Michael J Gruber <git@drmicha.warpmail.net> writes:\n\n>> Perhaps it needs documents which are more user friendly: I don't know where\n>> the 'lightweight' word is coming from (perhaps from the implementation) but\n>> I would expect that the _local_ term appears in the git-tag manual.\n>\n> It's the other way round. \"lightweight\" is in the first few lines of the\n> man, \"local\" nowhere. In fact I don't see it anywhere in the docs.\n\nSorry my previous reply wasn't clear, I meant that the word\n'lightweight' appears in the man page of git-tag but I don't see why\nsuch term is used, well now I can see but it's implementation detail\nso useless (or worth: confusing) for a dumb user (me).\n\nIn contrary I would have expected to find the 'local' word if git\nsupport local tags.\n\n>> I just need to create a local tag where I'm sure it won't be seen by others\n>> whatever the git operations I'm doing, normally a simple \"git tag\" switch\n>> should be enough...\n>\n> Taking \"whatever\" literally this is impossible, of course.\n> \n>\n> Taking it /cum grano salis/ it's still impossible within the same repo:\n> If others have read access they can \"ls-remote\" and \"fetch\" happily what\n> they want. The sane and easy way is to use a private repo for your local\n> work and all your \"local tags\", then to push to a public (i.e.\n> publically readable) repo those branches and tags which you want to be seen.\n>\n\nThis is how things are currently implemented but if lightweight is\nreally useless and local tags are somehow missing in Git then I'm\npretty sure it's possible to create such tags that are not seen by\ngit-{pull,push,fetch] operations.\n\n>\n> Are you a Mercurial user by any chance?\n\nNope.\n\n> \"hg tag -l\" creates local tags which are stored in an unversioned,\n> private file, whereas \"hg tag\" creates (and commits) a tag entry in\n> a versioned file, which is the source of some confusion and problems\n> with hg tags (\"hg co sometag\" does not contain sometag etc.). Maybe\n> you want the behaviour of \"hg tag -l\"?\n\nYes, It sounds that 'hg tag -l' is what I'm looking for in git...\n\nThanks\n-- \nFrancis\n"}]}