git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [JGIT PATCH] Fix push to empty repository
@ 2008-09-16  5:38 Shawn O. Pearce
  0 siblings, 0 replies; only message in thread
From: Shawn O. Pearce @ 2008-09-16  5:38 UTC (permalink / raw
  To: Robin Rosenberg; +Cc: git

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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2008-09-16  5:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-16  5:38 [JGIT PATCH] Fix push to empty repository Shawn O. Pearce

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).