{"thread":{"id":"35347","subject":"Symbolic refs break ref advertisement on 1.8.4.3+","startedAt":"2013-11-16T14:39:52Z","lastAt":"2013-11-18T18:16:32Z","messageCount":3,"participants":["Bryan Turner","Jeff King","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"230700","messageId":"CAGyf7-EX2QXKyAwoxv2Ux5cjSp71m-dR+Vq4C3pevJrYaGu42g@mail.gmail.com","threadId":"35347","inReplyTo":null,"subject":"Symbolic refs break ref advertisement on 1.8.4.3+","fromName":"Bryan Turner","fromEmail":"bturner@atlassian.com","sentAt":"2013-11-16T14:39:52Z","receivedAt":"2013-11-16T14:39:52Z","isPatch":false,"sender":{"key":"bturner@atlassian.com","avatar":"https://gravatar.com/avatar/16bcf3167981c1ef7c804e502642366d888a35b0d0b0a4ca01fdc442aa1acb1e?d=mp&s=160"},"body":"According to a git bisect between the v1.8.4 and v1.8.4.3 tags, it\nappears the changes in 5e7dcad, \"upload-pack: send non-HEAD symbolic\nrefs\", cause the ref advertisement to fail of the repository has more\nthan a handful of symbolic refs. Here's a simple reproduce case\n(tested on Bash):\n\nAphrael:example bturner$ git version\ngit version 1.8.4.3\nAphrael:symbolic-refs bturner$ git init example\nInitialized empty Git repository in /Users/bturner/example/.git/\nAphrael:symbolic-refs bturner$ cd example\nAphrael:example bturner$ echo \"Testing...\" > file.txt\nAphrael:example bturner$ git add file.txt\nAphrael:example bturner$ git commit -m \"Initial commit\"\n[master (root-commit) b4c4b2a] Initial commit\n 1 file changed, 1 insertion(+)\n create mode 100644 file.txt\nAphrael:example bturner$ for ((i=1;i<21;i++)); do git symbolic-ref\nrefs/heads/syms/$i refs/heads/master; done\nAphrael:example bturner$ git ls-remote .\nfatal: protocol error: impossibly long line\nfatal: Could not read from remote repository.\n\nA symref= entry is written into the first packet of the ref\nadvertisement, right after the capabilities, for each symbolic ref in\nthe repository. Unfortunately, no splitting is done on that value and\nso once you have 15-20 symbolic refs (more or less depending on path\nlengths), you blow the 996 byte limit in format_packet (pkt-line.c)\nand all further clone/fetch operations fail.\n\nI've verified this same issue exists in all 1.8.5 RCs.\n\nBest regards,\nBryan Turner\n"},{"id":"230729","messageId":"20131117100251.GB22166@sigill.intra.peff.net","threadId":"35347","inReplyTo":"CAGyf7-EX2QXKyAwoxv2Ux5cjSp71m-dR+Vq4C3pevJrYaGu42g@mail.gmail.com","subject":"Re: Symbolic refs break ref advertisement on 1.8.4.3+","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2013-11-17T10:02:51Z","receivedAt":"2013-11-17T10:02:51Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sun, Nov 17, 2013 at 01:39:52AM +1100, Bryan Turner wrote:\n\n> Aphrael:example bturner$ for ((i=1;i<21;i++)); do git symbolic-ref\n> refs/heads/syms/$i refs/heads/master; done\n> Aphrael:example bturner$ git ls-remote .\n> fatal: protocol error: impossibly long line\n> fatal: Could not read from remote repository.\n> \n> A symref= entry is written into the first packet of the ref\n> advertisement, right after the capabilities, for each symbolic ref in\n> the repository. Unfortunately, no splitting is done on that value and\n> so once you have 15-20 symbolic refs (more or less depending on path\n> lengths), you blow the 996 byte limit in format_packet (pkt-line.c)\n> and all further clone/fetch operations fail.\n\nIck, yeah. I don't think there is a way around that with the way the\ninformation is shoe-horned into the protocol.  We should probably just\nrevert 5e7dcad (upload-pack: send non-HEAD symbolic refs, 2013-09-17),\nand assume the HEAD branch name is short enough to fit.\n\nAnother option would be to cap the number of non-HEAD symrefs we'd send\n(by counting up the bytes and keeping below the limit). That at least\nmakes the \"easy\" cases work, but it's a bit too flaky for my taste.\n\n-Peff\n"},{"id":"230771","messageId":"xmqqr4adbmnz.fsf@gitster.dls.corp.google.com","threadId":"35347","inReplyTo":"20131117100251.GB22166@sigill.intra.peff.net","subject":"Re: Symbolic refs break ref advertisement on 1.8.4.3+","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-11-18T18:16:32Z","receivedAt":"2013-11-18T18:16:32Z","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> On Sun, Nov 17, 2013 at 01:39:52AM +1100, Bryan Turner wrote:\n>\n>> Aphrael:example bturner$ for ((i=1;i<21;i++)); do git symbolic-ref\n>> refs/heads/syms/$i refs/heads/master; done\n>> Aphrael:example bturner$ git ls-remote .\n>> fatal: protocol error: impossibly long line\n>> fatal: Could not read from remote repository.\n>> \n>> A symref= entry is written into the first packet of the ref\n>> advertisement, right after the capabilities, for each symbolic ref in\n>> the repository. Unfortunately, no splitting is done on that value and\n>> so once you have 15-20 symbolic refs (more or less depending on path\n>> lengths), you blow the 996 byte limit in format_packet (pkt-line.c)\n>> and all further clone/fetch operations fail.\n>\n> Ick, yeah. I don't think there is a way around that with the way the\n> information is shoe-horned into the protocol.  We should probably just\n> revert 5e7dcad (upload-pack: send non-HEAD symbolic refs, 2013-09-17),\n> and assume the HEAD branch name is short enough to fit.\n>\n> Another option would be to cap the number of non-HEAD symrefs we'd send\n> (by counting up the bytes and keeping below the limit). That at least\n> makes the \"easy\" cases work, but it's a bit too flaky for my taste.\n\nThanks Bryan for an easy reproduction, and thanks Peff for a\nsuggestion.  Let's revert that one for now.\n"}]}