{"thread":{"id":"45859","subject":"Cloning a custom refspec does not work as expected","startedAt":"2017-05-03T12:16:54Z","lastAt":"2017-05-03T20:04:11Z","messageCount":3,"participants":["Sebastian Schuberth","Stefan Beller","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"318646","messageId":"CAHGBnuMUrNFv30d+pjheiCAikM89XshQTFuDXBzu+EcxNY_94w@mail.gmail.com","threadId":"45859","inReplyTo":null,"subject":"Cloning a custom refspec does not work as expected","fromName":"Sebastian Schuberth","fromEmail":"sschuberth@gmail.com","sentAt":"2017-05-03T12:16:47Z","receivedAt":"2017-05-03T12:16:54Z","isPatch":false,"sender":{"key":"sschuberth@gmail.com","avatar":"https://avatars.githubusercontent.com/u/349154?v=4"},"body":"Hi,\n\nI'm trying to clone a custom ref, avoiding the need to init && fetch\nmanually. From reading [1] which says:\n\n\"Set a configuration variable in the newly-created repository; this\ntakes effect immediately after the repository is initialized, but\nbefore the remote history is fetched or any files checked out. [...]\nThis makes it safe, for example, to add additional fetch refspecs to\nthe origin remote.\"\n\nI'd assume that this would work:\n\n$ git clone -c remote.origin.fetch=+refs/changes/*:refs/remotes/origin/changes/*\nhttps://gerrit.googlesource.com/git-repo\n\nIn fact, this *does* add the custom refs correct to .git/config, but\nthey are not fetched during the clone. I can manually fix that by\ndoing\n\n$ cd git-repo\n$ git fetch\n\nafterwards, but the whole point is to avoid exactly that separate step.\n\nIs this a code bug or documentation bug?\n\nI'm using git version 2.12.2.windows.2.\n\n[1] https://git-scm.com/docs/git-clone#git-clone---configltkeygtltvaluegt\n\n-- \nSebastian Schuberth\n"},{"id":"318686","messageId":"CAGZ79kb=x38ELzZK3jxh1v6ivWD=D9_=-2nGCwR_m+zN0S0oSQ@mail.gmail.com","threadId":"45859","inReplyTo":"CAHGBnuMUrNFv30d+pjheiCAikM89XshQTFuDXBzu+EcxNY_94w@mail.gmail.com","subject":"Re: Cloning a custom refspec does not work as expected","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2017-05-03T18:27:57Z","receivedAt":"2017-05-03T18:28:02Z","isPatch":false,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Wed, May 3, 2017 at 5:16 AM, Sebastian Schuberth\n<sschuberth@gmail.com> wrote:\n> Hi,\n>\n> I'm trying to clone a custom ref, avoiding the need to init && fetch\n> manually. From reading [1] which says:\n>\n> \"Set a configuration variable in the newly-created repository; this\n> takes effect immediately after the repository is initialized, but\n> before the remote history is fetched or any files checked out. [...]\n> This makes it safe, for example, to add additional fetch refspecs to\n> the origin remote.\"\n>\n> I'd assume that this would work:\n>\n> $ git clone -c remote.origin.fetch=+refs/changes/*:refs/remotes/origin/changes/*\n> https://gerrit.googlesource.com/git-repo\n>\n> In fact, this *does* add the custom refs correct to .git/config, but\n> they are not fetched during the clone. I can manually fix that by\n> doing\n>\n> $ cd git-repo\n> $ git fetch\n>\n> afterwards, but the whole point is to avoid exactly that separate step.\n>\n> Is this a code bug or documentation bug?\n\nI would blame the code to be buggy, as it first writes out the config\nand then doesn't read the config, but blindly performs some magic\nto come up with the refspec to fetch and performs that fetch.\n\nThanks,\nStefan\n\n>\n> I'm using git version 2.12.2.windows.2.\n>\n> [1] https://git-scm.com/docs/git-clone#git-clone---configltkeygtltvaluegt\n>\n> --\n> Sebastian Schuberth\n"},{"id":"318696","messageId":"20170503200345.mjxvcv4o4wce3ddr@sigill.intra.peff.net","threadId":"45859","inReplyTo":"CAHGBnuMUrNFv30d+pjheiCAikM89XshQTFuDXBzu+EcxNY_94w@mail.gmail.com","subject":"Re: Cloning a custom refspec does not work as expected","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-05-03T20:03:45Z","receivedAt":"2017-05-03T20:04:11Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, May 03, 2017 at 02:16:47PM +0200, Sebastian Schuberth wrote:\n\n> I'd assume that this would work:\n> \n> $ git clone -c remote.origin.fetch=+refs/changes/*:refs/remotes/origin/changes/*\n> https://gerrit.googlesource.com/git-repo\n> \n> In fact, this *does* add the custom refs correct to .git/config, but\n> they are not fetched during the clone. I can manually fix that by\n> doing\n> \n> $ cd git-repo\n> $ git fetch\n> \n> afterwards, but the whole point is to avoid exactly that separate step.\n> \n> Is this a code bug or documentation bug?\n\nI think it's a code bug. More discussion in:\n\n  http://public-inbox.org/git/robbat2-20170225T185056-448272755Z@orbis-terrarum.net/\n\n-Peff\n"}]}