{"thread":{"id":"26571","subject":"How to create tags outside of refs/tags?","startedAt":"2011-02-21T17:21:57Z","lastAt":"2011-02-23T16:36:35Z","messageCount":16,"participants":["Christian Halstrick","Jay Soffian","Junio C Hamano","Jeff King","Jakub Narebski","Michael J Gruber","Enrico Weigelt"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"161827","messageId":"AANLkTimxAhMfPsqEJVyteuTzXLr+QnhcxpJLgaE=y12_@mail.gmail.com","threadId":"26571","inReplyTo":null,"subject":"How to create tags outside of refs/tags?","fromName":"Christian Halstrick","fromEmail":"christian.halstrick@gmail.com","sentAt":"2011-02-21T17:21:57Z","receivedAt":"2011-02-21T17:21:57Z","isPatch":false,"sender":{"key":"christian.halstrick@gmail.com","avatar":"https://gravatar.com/avatar/3598bf518644c7dc32d4dcd8e0554b6a313e12103011862402c83ae2854203ce?d=mp&s=160"},"body":"I would like to create a tag which full name is not starting with\nrefs/tags. Is that possible with 'git tag'? If not, is there any\nother command to create such tags?\n\nI would like to create such tags to mark released states of my sources\nwhich should never be garbage collected in case no branch is pointing\nthem anymore. On the other hand these tags should not pollute the\nnamespace of normal tags, means: don't want a 'git tag' command to\nlist those technical tags.\n\nCiao\n Chris\n"},{"id":"161830","messageId":"AANLkTi=CseZLobCoq+Li0AexHR+eaZpe84DG5hGzWHzR@mail.gmail.com","threadId":"26571","inReplyTo":"AANLkTimxAhMfPsqEJVyteuTzXLr+QnhcxpJLgaE=y12_@mail.gmail.com","subject":"Re: How to create tags outside of refs/tags?","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2011-02-21T17:48:51Z","receivedAt":"2011-02-21T17:48:51Z","isPatch":false,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"On Mon, Feb 21, 2011 at 12:21 PM, Christian Halstrick\n<christian.halstrick@gmail.com> wrote:\n> I would like to create a tag which full name is not starting with\n> refs/tags. Is that possible with 'git tag'?\n\nNope.\n\n> If not, is there any other command to create such tags?\n\nIf it's just a light-weight tag, you can use the low-level (plumbing)\ncommand update-ref to create an arbitrary ref:\n\n$ git update-ref refs/blargh HEAD\n\nIf it's an annotated/signed tag you want, you'll have to first create\nthe tag object with 'git mktag', then use update-ref to create a ref\nto that tag.\n\nSee git-tag.sh in the contrib directory of git.git.\n\nHTH,\n\nj.\n"},{"id":"161847","messageId":"7vpqqlgd3q.fsf@alter.siamese.dyndns.org","threadId":"26571","inReplyTo":"AANLkTi=CseZLobCoq+Li0AexHR+eaZpe84DG5hGzWHzR@mail.gmail.com","subject":"Re: How to create tags outside of refs/tags?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-02-21T23:52:09Z","receivedAt":"2011-02-21T23:52:09Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jay Soffian <jaysoffian@gmail.com> writes:\n\n> On Mon, Feb 21, 2011 at 12:21 PM, Christian Halstrick\n> <christian.halstrick@gmail.com> wrote:\n>> I would like to create a tag which full name is not starting with\n>> refs/tags. Is that possible with 'git tag'?\n>\n> Nope.\n>\n>> If not, is there any other command to create such tags?\n>\n> If it's just a light-weight tag, you can use the low-level (plumbing)\n> command update-ref to create an arbitrary ref:\n\nThat is a very unfriendly answer.  You shouldn't be answering everybody\nwho ask \"How do I shoot my foot off?  git-foo command does not seem to let\nme do so\" with \"Here is how to do that\".\n\n> $ git update-ref refs/blargh HEAD\n\nAt least, please say \"that thing is no longer a tag, many git commands\nwould complain because refs/blargh does not have two-levels, and do not\never think about starting that thing without 'refs/', or your 'gc' may end\nup losing that object\" when you give a potentially dangerous hint like\nthat (the last one being the most important).\n"},{"id":"161859","messageId":"AANLkTi=7yUh9J9S5LdpNY0SwCv008ih2LEd3KNvy46sL@mail.gmail.com","threadId":"26571","inReplyTo":"AANLkTimxAhMfPsqEJVyteuTzXLr+QnhcxpJLgaE=y12_@mail.gmail.com","subject":"Re: How to create tags outside of refs/tags?","fromName":"Christian Halstrick","fromEmail":"christian.halstrick@gmail.com","sentAt":"2011-02-22T06:17:20Z","receivedAt":"2011-02-22T06:17:20Z","isPatch":false,"sender":{"key":"christian.halstrick@gmail.com","avatar":"https://gravatar.com/avatar/3598bf518644c7dc32d4dcd8e0554b6a313e12103011862402c83ae2854203ce?d=mp&s=160"},"body":"But look at my intention:\n\nOn Mon, Feb 21, 2011 at 18:21, Christian Halstrick\n<christian.halstrick@gmail.com> wrote:\n> I would like to create such tags to mark released states of my sources\n> which should never be garbage collected in case no branch is pointing\n> them anymore. On the other hand these tags should not pollute the\n> namespace of normal tags, means: don't want a 'git tag' command to\n> list those technical tags.\n\nIs there any better way to achieve that certain commits are not\ngarbage collected than to create such tags. I love my foot and don't\nwant to \"shoot if off\" but I want to make sure the the\n\"release-process-machinery\" in our company can be sure that certain\nsource states are never gc'ed. I can also live with creating normal\ntags 'refs/tags/release/1.20' but would prefer a solution where 'git\ntags' shows only developer created tags.\n\nWill any ref underneath \"refs/' prevent gc to garbage collect a\ncommit? Or only those in the well-known locations (e.g. refs/tags/*)\n"},{"id":"161864","messageId":"20110222080305.GA11177@sigill.intra.peff.net","threadId":"26571","inReplyTo":"AANLkTi=7yUh9J9S5LdpNY0SwCv008ih2LEd3KNvy46sL@mail.gmail.com","subject":"Re: How to create tags outside of refs/tags?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-02-22T08:03:05Z","receivedAt":"2011-02-22T08:03:05Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Feb 22, 2011 at 07:17:20AM +0100, Christian Halstrick wrote:\n\n> On Mon, Feb 21, 2011 at 18:21, Christian Halstrick\n> <christian.halstrick@gmail.com> wrote:\n> > I would like to create such tags to mark released states of my sources\n> > which should never be garbage collected in case no branch is pointing\n> > them anymore. On the other hand these tags should not pollute the\n> > namespace of normal tags, means: don't want a 'git tag' command to\n> > list those technical tags.\n> \n> Is there any better way to achieve that certain commits are not\n> garbage collected than to create such tags. I love my foot and don't\n> want to \"shoot if off\" but I want to make sure the the\n> \"release-process-machinery\" in our company can be sure that certain\n> source states are never gc'ed. I can also live with creating normal\n> tags 'refs/tags/release/1.20' but would prefer a solution where 'git\n> tags' shows only developer created tags.\n\nIt sounds a lot saner to me to fix \"git tag\", then, to ignore certain\nuninteresting bits of the tag namespace. We already do allow pattern\nmatching the tags shown, but:\n\n  1. It's an fnmatch, so I don't think there is a way to do a negative\n     match like \"ignore everything that matches release/*\".\n\n  2. It can only be specified on the command-line, whereas obviously you\n     would want this as the default for a repo when you type \"git tag\".\n\nSo I think we could do something like the patch below, which allows:\n\n  # set up some boring and interesting tags\n  for i in boring more-boring interesting; do\n    for j in one two three; do\n      git tag $i/$j\n    done\n  done\n\n  # tell git to ignore boring stuff\n  git config tag.ignore 'boring/*'\n  git config --add tag.ignore 'more-boring/*'\n\n  # only interesting tags are shown\n  git tag\n\n  # only interesting tags are checked for --contains\n  git tag --contains HEAD\n\n  # all tags are shown\n  git tag --no-ignore\n\nOne alternative would be to allow specifying a default pattern in the\nconfig, and then some way of marking it as a regex instead of fnmatch.\nThen you could (in theory) construct a regex that negatively matches\nyour boring refs. Although without perl-compatibile negative look-ahead,\nsuch regexes can get pretty hard to write.\n\nAnyway, here's what the patch looks like. Obviously missing docs and\ntests.\n\n---\ndiff --git a/builtin/tag.c b/builtin/tag.c\nindex 46f7138..629dfa3 100644\n--- a/builtin/tag.c\n+++ b/builtin/tag.c\n@@ -12,6 +12,7 @@\n #include \"tag.h\"\n #include \"run-command.h\"\n #include \"parse-options.h\"\n+#include \"string-list.h\"\n \n static const char * const git_tag_usage[] = {\n \t\"git tag [-a|-s|-u <key-id>] [-f] [-m <msg>|-F <file>] <tagname> [<head>]\",\n@@ -27,8 +28,11 @@ struct tag_filter {\n \tconst char *pattern;\n \tint lines;\n \tstruct commit_list *with_commit;\n+\tconst struct string_list *ignore;\n };\n \n+static struct string_list ignore_tags = STRING_LIST_INIT_DUP;\n+\n static int show_reference(const char *refname, const unsigned char *sha1,\n \t\t\t  int flag, void *cb_data)\n {\n@@ -41,6 +45,13 @@ static int show_reference(const char *refname, const unsigned char *sha1,\n \t\tchar *buf, *sp, *eol;\n \t\tsize_t len;\n \n+\t\tif (filter->ignore) {\n+\t\t\tfor (i = 0; i < filter->ignore->nr; i++)\n+\t\t\t\tif (!fnmatch(filter->ignore->items[i].string,\n+\t\t\t\t\t     refname, 0))\n+\t\t\t\t\treturn 0;\n+\t\t}\n+\n \t\tif (filter->with_commit) {\n \t\t\tstruct commit *commit;\n \n@@ -89,7 +100,8 @@ static int show_reference(const char *refname, const unsigned char *sha1,\n }\n \n static int list_tags(const char *pattern, int lines,\n-\t\t\tstruct commit_list *with_commit)\n+\t\t\tstruct commit_list *with_commit,\n+\t\t\tconst struct string_list *ignore)\n {\n \tstruct tag_filter filter;\n \n@@ -99,6 +111,7 @@ static int list_tags(const char *pattern, int lines,\n \tfilter.pattern = pattern;\n \tfilter.lines = lines;\n \tfilter.with_commit = with_commit;\n+\tfilter.ignore = ignore;\n \n \tfor_each_tag_ref(show_reference, (void *) &filter);\n \n@@ -233,6 +246,13 @@ static int git_tag_config(const char *var, const char *value, void *cb)\n \t\treturn 0;\n \t}\n \n+\tif (!strcmp(var, \"tag.ignore\")) {\n+\t\tif (!value)\n+\t\t\treturn config_error_nonbool(var);\n+\t\tstring_list_append(&ignore_tags, value);\n+\t\treturn 0;\n+\t}\n+\n \treturn git_default_config(var, value, cb);\n }\n \n@@ -365,6 +385,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix)\n \tconst char *msgfile = NULL, *keyid = NULL;\n \tstruct msg_arg msg = { 0, STRBUF_INIT };\n \tstruct commit_list *with_commit = NULL;\n+\tint ignore = 1;\n \tstruct option options[] = {\n \t\tOPT_BOOLEAN('l', NULL, &list, \"list tag names\"),\n \t\t{ OPTION_INTEGER, 'n', NULL, &lines, \"n\",\n@@ -391,6 +412,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix)\n \t\t\tPARSE_OPT_LASTARG_DEFAULT,\n \t\t\tparse_opt_with_commit, (intptr_t)\"HEAD\",\n \t\t},\n+\t\tOPT_BOOLEAN(0, \"ignore\", &ignore, \"respect tag.ignore config\"),\n \t\tOPT_END()\n \t};\n \n@@ -415,7 +437,8 @@ int cmd_tag(int argc, const char **argv, const char *prefix)\n \t\tusage_with_options(git_tag_usage, options);\n \tif (list)\n \t\treturn list_tags(argv[0], lines == -1 ? 0 : lines,\n-\t\t\t\t with_commit);\n+\t\t\t\t with_commit,\n+\t\t\t\t ignore ? &ignore_tags : NULL);\n \tif (lines != -1)\n \t\tdie(\"-n option is only allowed with -l.\");\n \tif (with_commit)\n"},{"id":"161865","messageId":"7vvd0cebi6.fsf@alter.siamese.dyndns.org","threadId":"26571","inReplyTo":"20110222080305.GA11177@sigill.intra.peff.net","subject":"Re: How to create tags outside of refs/tags?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-02-22T08:09:37Z","receivedAt":"2011-02-22T08:09:37Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> It sounds a lot saner to me to fix \"git tag\", then, to ignore certain\n> uninteresting bits of the tag namespace. We already do allow pattern\n> matching the tags shown, but:\n>\n>   1. It's an fnmatch, so I don't think there is a way to do a negative\n>      match like \"ignore everything that matches release/*\".\n>\n>   2. It can only be specified on the command-line, whereas obviously you\n>      would want this as the default for a repo when you type \"git tag\".\n>\n> So I think we could do something like the patch below, which allows:\n>\n>   # set up some boring and interesting tags\n>   for i in boring more-boring interesting; do\n>     for j in one two three; do\n>       git tag $i/$j\n>     done\n>   done\n>\n>   # tell git to ignore boring stuff\n>   git config tag.ignore 'boring/*'\n>   git config --add tag.ignore 'more-boring/*'\n\nHmph, isn't that what \"grep -v\" was invented for?\n\nAlso it is unclear if the boring tags will or will not be propagated (or\nshould or should not be, for that matter) to outer world when you do \"git\npush --tags\" with your \"ignore\".  Most likely some people do want to see\nthem hidden (e.g. when publishing), and some others do want to be pushed\n(e.g. when backing the repository up).\n"},{"id":"161867","messageId":"20110222081458.GA11825@sigill.intra.peff.net","threadId":"26571","inReplyTo":"7vvd0cebi6.fsf@alter.siamese.dyndns.org","subject":"Re: How to create tags outside of refs/tags?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-02-22T08:14:58Z","receivedAt":"2011-02-22T08:14:58Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Feb 22, 2011 at 12:09:37AM -0800, Junio C Hamano wrote:\n\n> >   # tell git to ignore boring stuff\n> >   git config tag.ignore 'boring/*'\n> >   git config --add tag.ignore 'more-boring/*'\n> \n> Hmph, isn't that what \"grep -v\" was invented for?\n\nHeh. Yeah, but I think the point is that you will want to do this _every\ntime_, so it saves typing. I guess you could make an alias. Or even more\nhack-ish, a custom tag.pager that filters the results. ;)\n\nYet another option that would work in my example is to use\n\"interesting/*\" as a positive pattern. But that implies that all of the\ninteresting ones can be grouped in that way.\n\nI dunno. I don't really care much either way. I would probably not be a\nuser of this feature myself.\n\n> Also it is unclear if the boring tags will or will not be propagated (or\n> should or should not be, for that matter) to outer world when you do \"git\n> push --tags\" with your \"ignore\".  Most likely some people do want to see\n> them hidden (e.g. when publishing), and some others do want to be pushed\n> (e.g. when backing the repository up).\n\nI think changing the config name to tag.list-ignore would make it more\nobvious what is going on. If you don't want to push certain tags, I\nthink refspecs are the way to do that, and this should be a purely local\ndisplay thing.\n\n-Peff\n"},{"id":"161870","messageId":"m3wrks756a.fsf@localhost.localdomain","threadId":"26571","inReplyTo":"20110222081458.GA11825@sigill.intra.peff.net","subject":"Re: How to create tags outside of refs/tags?","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2011-02-22T10:09:14Z","receivedAt":"2011-02-22T10:09:14Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Tue, Feb 22, 2011 at 12:09:37AM -0800, Junio C Hamano wrote:\n> \n> > >   # tell git to ignore boring stuff\n> > >   git config tag.ignore 'boring/*'\n> > >   git config --add tag.ignore 'more-boring/*'\n> > \n> > Hmph, isn't that what \"grep -v\" was invented for?\n> \n> Heh. Yeah, but I think the point is that you will want to do this _every\n> time_, so it saves typing. I guess you could make an alias. Or even more\n> hack-ish, a custom tag.pager that filters the results. ;)\n\n[...]\n> > Also it is unclear if the boring tags will or will not be propagated (or\n> > should or should not be, for that matter) to outer world when you do \"git\n> > push --tags\" with your \"ignore\".  Most likely some people do want to see\n> > them hidden (e.g. when publishing), and some others do want to be pushed\n> > (e.g. when backing the repository up).\n> \n> I think changing the config name to tag.list-ignore would make it more\n> obvious what is going on. If you don't want to push certain tags, I\n> think refspecs are the way to do that, and this should be a purely local\n> display thing.\n\nYou meant `tag.listIgnore`, weren't you?  No hyphens in config\nvariable names.\n\nAbout refspecs: we currently do not support negative refspecs, do we?\n(IIRC there was proposal to use '!' or '-' as prefix for them).  So we\ncan't currently exclude refs/tags/private/* while including\nrefs/tags/v*?\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"161880","messageId":"AANLkTim93jDnbTPYVk2zjxf+usPT==gMxK4ezUc9AcHx@mail.gmail.com","threadId":"26571","inReplyTo":"AANLkTi=7yUh9J9S5LdpNY0SwCv008ih2LEd3KNvy46sL@mail.gmail.com","subject":"Re: How to create tags outside of refs/tags?","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2011-02-22T15:06:39Z","receivedAt":"2011-02-22T15:06:39Z","isPatch":false,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"On Tue, Feb 22, 2011 at 1:17 AM, Christian Halstrick\n<christian.halstrick@gmail.com> wrote:\n> Is there any better way to achieve that certain commits are not\n> garbage collected than to create such tags. I love my foot and don't\n> want to \"shoot if off\" but I want to make sure the the\n> \"release-process-machinery\" in our company can be sure that certain\n> source states are never gc'ed. I can also live with creating normal\n> tags 'refs/tags/release/1.20' but would prefer a solution where 'git\n> tags' shows only developer created tags.\n\nYes, I'm sorry I wasn't more careful/clearer in my earlier reply.\n\n> Will any ref underneath \"refs/' prevent gc to garbage collect a\n> commit? Or only those in the well-known locations (e.g. refs/tags/*)\n\nAnything under refs/ is safe, but you should create a subdirectory so\nthat you've got your own name-space under there. For example, the\ngerrit code review system uses refs/changes/ for its refs.\n\nBecause these refs would be outside git's normal name-spaces\n(refs/heads and refs/tags), they won't be fetched by the default\n(non-mirror) refspec.\n\nj.\n"},{"id":"161884","messageId":"20110222152723.GA23353@sigill.intra.peff.net","threadId":"26571","inReplyTo":"m3wrks756a.fsf@localhost.localdomain","subject":"Re: How to create tags outside of refs/tags?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-02-22T15:27:23Z","receivedAt":"2011-02-22T15:27:23Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Feb 22, 2011 at 02:09:14AM -0800, Jakub Narebski wrote:\n\n> > I think changing the config name to tag.list-ignore would make it more\n> > obvious what is going on. If you don't want to push certain tags, I\n> > think refspecs are the way to do that, and this should be a purely local\n> > display thing.\n> \n> You meant `tag.listIgnore`, weren't you?  No hyphens in config\n> variable names.\n\nSure.\n\n> About refspecs: we currently do not support negative refspecs, do we?\n> (IIRC there was proposal to use '!' or '-' as prefix for them).  So we\n> can't currently exclude refs/tags/private/* while including\n> refs/tags/v*?\n\nYeah, I think you might be stuck enumerating the tags you want via\nrefspec. But I stand by my statement; if this feature is something we\nwant, it should be purely about listing tags. I don't want to get into\nweird tag-specific config affecting the what we push. If somebody wants\nnegative refspecs, that can be a separate patch.\n\nBut like I said before, I am lukewarm on the patch in the first place.\n\n-Peff\n"},{"id":"161892","messageId":"AANLkTinTj7BehKYc15jbQzMq+q=2CfLvzTkGSJ-Ps-FH@mail.gmail.com","threadId":"26571","inReplyTo":"20110222152723.GA23353@sigill.intra.peff.net","subject":"Re: How to create tags outside of refs/tags?","fromName":"Christian Halstrick","fromEmail":"christian.halstrick@gmail.com","sentAt":"2011-02-22T16:21:37Z","receivedAt":"2011-02-22T16:21:37Z","isPatch":false,"sender":{"key":"christian.halstrick@gmail.com","avatar":"https://gravatar.com/avatar/3598bf518644c7dc32d4dcd8e0554b6a313e12103011862402c83ae2854203ce?d=mp&s=160"},"body":"On Tue, Feb 22, 2011 at 16:27, Jeff King <peff@peff.net> wrote:\n> On Tue, Feb 22, 2011 at 02:09:14AM -0800, Jakub Narebski wrote:\n> refspec. But I stand by my statement; if this feature is something we\n> want, it should be purely about listing tags. I don't want to get into\n> weird tag-specific config affecting the what we push. If somebody wants\n> negative refspecs, that can be a separate patch.\n\nI am not sure whether what is discussed now is really solving my\nproblem best. Maybe I rephrase again the problem I have:\nI just want to make sure that certain commits are not garbage\ncollected. And the artefacts I create to ensure that should not\npollute the namespace of developer-created tags/branches. Is creating\na tag and then hiding it again really the best solution for that?\n\nHere is some background: there is a tool developed in our company\nwhich helps teams to release their git-controlled products. The\nrelease tool gets as input just a commit ID. Whenever the release tool\nhas succesfully done his work on a product it wants to make sure the\nthis commit will never be garbage collected. Even not if month's later\nthe product owner resets all their branches making the released\ncommits beeing unreachable. And since some projects may run a lot of\nattempts until they finally released some stuff we don't to have our\ntags namespace to\nbe polluted with too many attempt-to-release tags.\n"},{"id":"161902","messageId":"7v7hcrewyz.fsf@alter.siamese.dyndns.org","threadId":"26571","inReplyTo":"AANLkTinTj7BehKYc15jbQzMq+q=2CfLvzTkGSJ-Ps-FH@mail.gmail.com","subject":"Re: How to create tags outside of refs/tags?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-02-22T18:38:12Z","receivedAt":"2011-02-22T18:38:12Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Christian Halstrick <christian.halstrick@gmail.com> writes:\n\n> I am not sure whether what is discussed now is really solving my\n> problem best. Maybe I rephrase again the problem I have:\n> I just want to make sure that certain commits are not garbage\n> collected. And the artefacts I create to ensure that should not\n> pollute the namespace of developer-created tags/branches. Is creating\n> a tag and then hiding it again really the best solution for that?\n>\n> Here is some background: there is a tool developed in our company which\n> helps teams to release their git-controlled products. The release tool\n> gets as input just a commit ID. Whenever the release tool has\n> succesfully done his work on a product it wants to make sure the this\n> commit will never be garbage collected. Even not if month's later the\n> product owner resets all their branches making the released commits\n> beeing unreachable. And since some projects may run a lot of attempts\n> until they finally released some stuff we don't to have our tags\n> namespace to be polluted with too many attempt-to-release tags.\n\nHow about taking advantage of the fact that you do not have to treat tag\nnamespace as a global thing?  For the \"release tool\" to \"get a commit ID\"\nand do something useful, the \"release tool\" must be working on a git\nrepository, and hopefully that repository is something other than the ones\ndevelopers directly play with (by checking out random branches in its\nworking tree and compiling, etc.).\n\nYou can run \"git tag\" in that \"release tool\" repository, and if you do not\nwant to show that to others, never let developers fetch tags from there.\n\nI would think that using a private namespace other than tags for your own\nuse (e.g. \"git update-ref refs/anchor/release-20110222 $that_commit\") may\nbe the best option that is easiest to understand, though.\n"},{"id":"161914","messageId":"AANLkTiki9W_mJKLON+punKJLDWx5rmQdZ3bS16zadYFj@mail.gmail.com","threadId":"26571","inReplyTo":"7v7hcrewyz.fsf@alter.siamese.dyndns.org","subject":"Re: How to create tags outside of refs/tags?","fromName":"Christian Halstrick","fromEmail":"christian.halstrick@gmail.com","sentAt":"2011-02-22T22:08:47Z","receivedAt":"2011-02-22T22:08:47Z","isPatch":false,"sender":{"key":"christian.halstrick@gmail.com","avatar":"https://gravatar.com/avatar/3598bf518644c7dc32d4dcd8e0554b6a313e12103011862402c83ae2854203ce?d=mp&s=160"},"body":"Hi,\n\n> How about taking advantage of the fact that you do not have to treat tag\n> namespace as a global thing?  For the \"release tool\" to \"get a commit ID\"\n> and do something useful, the \"release tool\" must be working on a git\n> repository, and hopefully that repository is something other than the ones\n> developers directly play with (by checking out random branches in its\n> working tree and compiling, etc.).\n\nThese assumptions are all correct. The \"release tool\" works on his clone\nof a central repo. The release tool may even modify the content (e.g. increasing\nrelease numbers in project metadata files) and create new git commits.\nIn the end it wants to create tags/refs locally und push these tags back\nso that in the central repo the commits are not gc'ed.\n\nSomething like:\n\ncd <releaseRepo>\ngit fetch origin\ngit checkout <commitIdToRelease>\nedit pom.xml; git add pom.xml\ngit commit -m \"release ...\"\ngit tag <releaseName>\ngit push origin 'refs/tags/<releaseName>:refs/releases/<releaseName>'\n\nshould do the job, or?\n"},{"id":"162022","messageId":"4D6500C5.7020803@drmicha.warpmail.net","threadId":"26571","inReplyTo":"AANLkTiki9W_mJKLON+punKJLDWx5rmQdZ3bS16zadYFj@mail.gmail.com","subject":"Re: How to create tags outside of refs/tags?","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2011-02-23T12:42:45Z","receivedAt":"2011-02-23T12:42:45Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Christian Halstrick venit, vidit, dixit 22.02.2011 23:08:\n> Hi,\n> \n>> How about taking advantage of the fact that you do not have to treat tag\n>> namespace as a global thing?  For the \"release tool\" to \"get a commit ID\"\n>> and do something useful, the \"release tool\" must be working on a git\n>> repository, and hopefully that repository is something other than the ones\n>> developers directly play with (by checking out random branches in its\n>> working tree and compiling, etc.).\n> \n> These assumptions are all correct. The \"release tool\" works on his clone\n> of a central repo. The release tool may even modify the content (e.g. increasing\n> release numbers in project metadata files) and create new git commits.\n> In the end it wants to create tags/refs locally und push these tags back\n> so that in the central repo the commits are not gc'ed.\n> \n> Something like:\n> \n> cd <releaseRepo>\n> git fetch origin\n> git checkout <commitIdToRelease>\n> edit pom.xml; git add pom.xml\n> git commit -m \"release ...\"\n> git tag <releaseName>\n> git push origin 'refs/tags/<releaseName>:refs/releases/<releaseName>'\n> \n> should do the job, or?\n\nYep. Also, if you do\n\ngit tag release/<releasename>\n\nthen a simple push refspec 'refs/tags/release/*:refs/releases/*' in your\nconfig does the job. (Assuming you don't have any other tags in release/.)\n\nMichael\n"},{"id":"162026","messageId":"AANLkTinEFRn2AqT7c56MgZ94nk4JL-tRnWgW8iQQHf4f@mail.gmail.com","threadId":"26571","inReplyTo":"4D6500C5.7020803@drmicha.warpmail.net","subject":"Re: How to create tags outside of refs/tags?","fromName":"Christian Halstrick","fromEmail":"christian.halstrick@gmail.com","sentAt":"2011-02-23T13:45:58Z","receivedAt":"2011-02-23T13:45:58Z","isPatch":false,"sender":{"key":"christian.halstrick@gmail.com","avatar":"https://gravatar.com/avatar/3598bf518644c7dc32d4dcd8e0554b6a313e12103011862402c83ae2854203ce?d=mp&s=160"},"body":"thanks all of you for your fast help. My problem is now solved.\n"},{"id":"162033","messageId":"20110223163634.GA16569@nibiru.local","threadId":"26571","inReplyTo":"7v7hcrewyz.fsf@alter.siamese.dyndns.org","subject":"Re: How to create tags outside of refs/tags?","fromName":"Enrico Weigelt","fromEmail":"weigelt@metux.de","sentAt":"2011-02-23T16:36:35Z","receivedAt":"2011-02-23T16:36:35Z","isPatch":false,"sender":{"key":"weigelt@metux.de","avatar":null},"body":"* Junio C Hamano <gitster@pobox.com> wrote:\n\nHi folks,\n\n\n> I would think that using a private namespace other than tags for your own\n> use (e.g. \"git update-ref refs/anchor/release-20110222 $that_commit\") may\n> be the best option that is easiest to understand, though.\n\nI'm doing similar things with source crawlers in the OSS-QM\nproject: each time a new upstream version arrives, it gets\ntag into a queue namespace, so I can pick them up an do my\nusual qm works on them one by one.\n\ngit ls-remote git://pubgit.metux.de/oss-qm/glib2.git | grep queue\n\n\ncu\n-- \n----------------------------------------------------------------------\n Enrico Weigelt, metux IT service -- http://www.metux.de/\n\n phone:  +49 36207 519931  email: weigelt@metux.de\n mobile: +49 151 27565287  icq:   210169427         skype: nekrad666\n----------------------------------------------------------------------\n Embedded-Linux / Portierung / Opensource-QM / Verteilte Systeme\n----------------------------------------------------------------------\n"}]}