From: "Shawn O. Pearce" <spearce@spearce.org>
To: Robin Rosenberg <robin.rosenberg@dewire.com>
Cc: git@vger.kernel.org
Subject: [JGIT PATCH] Fix push to empty repository
Date: Mon, 15 Sep 2008 22:38:04 -0700 [thread overview]
Message-ID: <1221543484-51295-1-git-send-email-spearce@spearce.org> (raw)
If the remote repository has no commits we received an exception
about "capabilities^{} coming before capabilities". This happens
because we didn't correctly ignore the dummy capability ref line.
http://code.google.com/p/egit/issues/detail?id=34
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
.../spearce/jgit/transport/BasePackConnection.java | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/org.spearce.jgit/src/org/spearce/jgit/transport/BasePackConnection.java b/org.spearce.jgit/src/org/spearce/jgit/transport/BasePackConnection.java
index 184a5fd..2d145a6 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/transport/BasePackConnection.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/transport/BasePackConnection.java
@@ -147,18 +147,18 @@ for (String c : line.substring(nul + 1).split(" "))
remoteCapablities.add(c);
line = line.substring(0, nul);
}
-
- if (line.equals("capabilities^{}")) {
- // special line from git-receive-pack to show
- // capabilities when there are no refs to advertise
- continue;
- }
}
if (line.length() == 0)
break;
String name = line.substring(41, line.length());
+ if (avail.isEmpty() && name.equals("capabilities^{}")) {
+ // special line from git-receive-pack to show
+ // capabilities when there are no refs to advertise
+ continue;
+ }
+
final ObjectId id = ObjectId.fromString(line.substring(0, 40));
if (name.endsWith("^{}")) {
name = name.substring(0, name.length() - 3);
--
1.6.0.1.337.g5c7d67
reply other threads:[~2008-09-16 5:39 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1221543484-51295-1-git-send-email-spearce@spearce.org \
--to=spearce@spearce.org \
--cc=git@vger.kernel.org \
--cc=robin.rosenberg@dewire.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).