{"thread":{"id":"15545","subject":"[JGIT PATCH] Fix push to empty repository","startedAt":"2008-09-16T05:38:04Z","lastAt":"2008-09-16T05:38:04Z","messageCount":1,"participants":["Shawn O. Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"90803","messageId":"1221543484-51295-1-git-send-email-spearce@spearce.org","threadId":"15545","inReplyTo":null,"subject":"[JGIT PATCH] Fix push to empty repository","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-09-16T05:38:04Z","receivedAt":"2008-09-16T05:38:04Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"If the remote repository has no commits we received an exception\nabout \"capabilities^{} coming before capabilities\".  This happens\nbecause we didn't correctly ignore the dummy capability ref line.\n\nhttp://code.google.com/p/egit/issues/detail?id=34\n\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n .../spearce/jgit/transport/BasePackConnection.java |   12 ++++++------\n 1 files changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/org.spearce.jgit/src/org/spearce/jgit/transport/BasePackConnection.java b/org.spearce.jgit/src/org/spearce/jgit/transport/BasePackConnection.java\nindex 184a5fd..2d145a6 100644\n--- a/org.spearce.jgit/src/org/spearce/jgit/transport/BasePackConnection.java\n+++ b/org.spearce.jgit/src/org/spearce/jgit/transport/BasePackConnection.java\n@@ -147,18 +147,18 @@ for (String c : line.substring(nul + 1).split(\" \"))\n \t\t\t\t\t\tremoteCapablities.add(c);\n \t\t\t\t\tline = line.substring(0, nul);\n \t\t\t\t}\n-\n-\t\t\t\tif (line.equals(\"capabilities^{}\")) {\n-\t\t\t\t\t// special line from git-receive-pack to show\n-\t\t\t\t\t// capabilities when there are no refs to advertise\n-\t\t\t\t\tcontinue;\n-\t\t\t\t}\n \t\t\t}\n \n \t\t\tif (line.length() == 0)\n \t\t\t\tbreak;\n \n \t\t\tString name = line.substring(41, line.length());\n+\t\t\tif (avail.isEmpty() && name.equals(\"capabilities^{}\")) {\n+\t\t\t\t// special line from git-receive-pack to show\n+\t\t\t\t// capabilities when there are no refs to advertise\n+\t\t\t\tcontinue;\n+\t\t\t}\n+\n \t\t\tfinal ObjectId id = ObjectId.fromString(line.substring(0, 40));\n \t\t\tif (name.endsWith(\"^{}\")) {\n \t\t\t\tname = name.substring(0, name.length() - 3);\n-- \n1.6.0.1.337.g5c7d67\n"}]}