{"thread":{"id":"27901","subject":"Excluding some refspecs from git push?","startedAt":"2011-07-23T21:46:50Z","lastAt":"2011-07-24T19:45:20Z","messageCount":4,"participants":["Paul Sokolovsky","Shawn Pearce","Magnus Bäck"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"171902","messageId":"20110724004650.408741c5@x34f","threadId":"27901","inReplyTo":null,"subject":"Excluding some refspecs from git push?","fromName":"Paul Sokolovsky","fromEmail":"paul.sokolovsky@linaro.org","sentAt":"2011-07-23T21:46:50Z","receivedAt":"2011-07-23T21:46:50Z","isPatch":false,"sender":{"key":"paul.sokolovsky@linaro.org","avatar":null},"body":"Hello,\n\nIs there a way to exclude some refspec from being processed by \"git\npush\"? What I'm looking for is a syntax like:\n\npush some-remote 'refs/*' '!refs/meta/config'\n\n, with the meaning of \"push all refs except refs/meta/config\". What I'm\ntrying to do with this is to find out a generic way to mirror git\nrepositories managed by the Gerrit tool\n(http://code.google.com/p/gerrit/), which since version 2.2 uses\nrefs/meta/config branch to store repository-local configuration, so\nshould not be mirrored between two Gerrit's.\n\n-- \nBest Regards,\nPaul\n\nLinaro.org | Open source software for ARM SoCs\nFollow Linaro: http://www.facebook.com/pages/Linaro\nhttp://twitter.com/#!/linaroorg - http://www.linaro.org/linaro-blog\n"},{"id":"171966","messageId":"CAH+XAApbbMSPW9XJPjYnmqNiECoWBz5du6CeD_hfAww9o_LcXA@mail.gmail.com","threadId":"27901","inReplyTo":"20110724004650.408741c5@x34f","subject":"Re: Excluding some refspecs from git push?","fromName":"Shawn Pearce","fromEmail":"sop@google.com","sentAt":"2011-07-24T19:19:33Z","receivedAt":"2011-07-24T19:19:33Z","isPatch":false,"sender":{"key":"sop@google.com","avatar":null},"body":"On Sat, Jul 23, 2011 at 14:46, Paul Sokolovsky\n<paul.sokolovsky@linaro.org> wrote:\n> Is there a way to exclude some refspec from being processed by \"git\n> push\"? What I'm looking for is a syntax like:\n>\n> push some-remote 'refs/*' '!refs/meta/config'\n>\n> , with the meaning of \"push all refs except refs/meta/config\". What I'm\n> trying to do with this is to find out a generic way to mirror git\n> repositories managed by the Gerrit tool\n> (http://code.google.com/p/gerrit/), which since version 2.2 uses\n> refs/meta/config branch to store repository-local configuration, so\n> should not be mirrored between two Gerrit's.\n\nUnfortunately no. But you should be able to just mirror the namespaces\nthat matter:\n\n  refs/heads/*\n  refs/tags/*\n\nIts not a good idea to mirror refs/meta/config unless you want the\nsame access controls, *AND ITS REALLY NOT A GOOD IDEA TO MIRROR\nrefs/changes/* BETWEEN GERRIT SERVERS*. Yes, that last part is worth\nwriting in full caps.\n"},{"id":"171971","messageId":"20110724193240.GA16283@jpl.local","threadId":"27901","inReplyTo":"CAH+XAApbbMSPW9XJPjYnmqNiECoWBz5du6CeD_hfAww9o_LcXA@mail.gmail.com","subject":"Re: Excluding some refspecs from git push?","fromName":"Magnus Bäck","fromEmail":"magnus.back@sonyericsson.com","sentAt":"2011-07-24T19:32:40Z","receivedAt":"2011-07-24T19:32:40Z","isPatch":false,"sender":{"key":"magnus.back@sonyericsson.com","avatar":null},"body":"On Sunday, July 24, 2011 at 21:19 CEST,\n     Shawn Pearce <sop@google.com> wrote:\n\n> On Sat, Jul 23, 2011 at 14:46, Paul Sokolovsky\n> <paul.sokolovsky@linaro.org> wrote:\n> > Is there a way to exclude some refspec from being processed by \"git\n> > push\"? What I'm looking for is a syntax like:\n> >\n> > push some-remote 'refs/*' '!refs/meta/config'\n> >\n> > , with the meaning of \"push all refs except refs/meta/config\". What\n> > I'm trying to do with this is to find out a generic way to mirror\n> > git repositories managed by the Gerrit tool\n> > (http://code.google.com/p/gerrit/), which since version 2.2 uses\n> > refs/meta/config branch to store repository-local configuration, so\n> > should not be mirrored between two Gerrit's.\n> \n> Unfortunately no. But you should be able to just mirror the namespaces\n> that matter:\n> \n>   refs/heads/*\n>   refs/tags/*\n\nAny reason to omit refs/notes/*?\n\n> Its not a good idea to mirror refs/meta/config unless you want the\n> same access controls, *AND ITS REALLY NOT A GOOD IDEA TO MIRROR\n> refs/changes/* BETWEEN GERRIT SERVERS*. Yes, that last part is worth\n> writing in full caps.\n\nBecause of the excessive number of refs to advertise for a non-Gerrit\nserver, or what's the reason for the full caps?\n\n-- \nMagnus Bäck                   Opinions are my own and do not necessarily\nSW Configuration Manager      represent the ones of my employer, etc.\nSony Ericsson\n"},{"id":"171970","messageId":"CAH+XAArFNE2NdGf=iZtrCzHCazY8d+LN9D6z21dfFX7h8dTNMQ@mail.gmail.com","threadId":"27901","inReplyTo":"20110724193240.GA16283@jpl.local","subject":"Re: Excluding some refspecs from git push?","fromName":"Shawn Pearce","fromEmail":"sop@google.com","sentAt":"2011-07-24T19:45:20Z","receivedAt":"2011-07-24T19:45:20Z","isPatch":false,"sender":{"key":"sop@google.com","avatar":null},"body":"On Sun, Jul 24, 2011 at 12:32, Magnus Bäck <magnus.back@sonyericsson.com> wrote:\n>>\n>> Unfortunately no. But you should be able to just mirror the namespaces\n>> that matter:\n>>\n>>   refs/heads/*\n>>   refs/tags/*\n>\n> Any reason to omit refs/notes/*?\n\nNo, I forgot about refs/notes/*. You probably also want to mirror that.\n\n>> Its not a good idea to mirror refs/meta/config unless you want the\n>> same access controls, *AND ITS REALLY NOT A GOOD IDEA TO MIRROR\n>> refs/changes/* BETWEEN GERRIT SERVERS*. Yes, that last part is worth\n>> writing in full caps.\n>\n> Because of the excessive number of refs to advertise for a non-Gerrit\n> server, or what's the reason for the full caps?\n\nThe excessive number of refs is a problem for any Git implementation\n(Gerrit included). But the all-caps warning is because of the way\nGerrit uses these refs.\n\nSometimes Gerrit scans the refs in a project, parses the change_id out\nof the reference name (e.g. refs/changes/42/1842/1 is change_id 1842)\nand then looks that change up in the database without matching the\nproject name. This can cause strange results, like an ancient change\nin project Foo suddenly emailing its reviewers saying it has been\nmerged into project SekretThing on branch\nNeverDiscloseThisToThatReviewerSet. We've had some pretty scary emails\nget sent out because of this matching. :-(\n\nObviously this is a bug in Gerrit, when scanning the change_id data\nfrom the references, we should at least double-check the project\nnames. But even with that check, two different Gerrit servers could\nboth create change 1842 (as totally different changes) in the same\nproject... e.g. if the servers each have exactly 1 project. Copying\nthe refs from one server to the other may overwrite or at least\nconfuse the destination's change data.\n\nUntil the refs/changes/ namespace is modified to be more dependent\nupon Change-Id tokens and not the unique change_id sequence in the\ndatabase, copying refs/changes/* between Gerrit servers is not a good\nidea.  (Though it is OK if copied from a master to a slave, they share\nthe same change database.)\n"}]}