git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH JGIT] Fix parsing peeled line in packed-ref

From
Daniel Cheng (aka SDiZ) <j16sdiz+freenet@gmail.com>
Date
Mar 6, 2009, 16:05 UTC
Message-ID
<1236355550-5764-1-git-send-email-j16sdiz+freenet@gmail.com>
From: Daniel Cheng (aka SDiZ) <j16sdiz+freenet@sdiz.net>

When doing a WalkTransport with packed-ref, peeled line are not handled correctly. This patch fix the issue.

Signed-off-by: Daniel Cheng (aka SDiZ) <j16sdiz+freenet@gmail.com>
---
 .../jgit/transport/WalkRemoteObjectDatabase.java   |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/org.spearce.jgit/src/org/spearce/jgit/transport/WalkRemoteObjectDatabase.java b/org.spearce.jgit/src/org/spearce/jgit/transport/WalkRemoteObjectDatabase.java
index a4f8961..d8e727b 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/transport/WalkRemoteObjectDatabase.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/transport/WalkRemoteObjectDatabase.java
@@ -436,7 +436,7 @@ private void readPackedRefsImpl(final Map<String, Ref> avail,
 			if (line.charAt(0) == '^') {
 				if (last == null)
 					throw new TransportException("Peeled line before ref.");
-				final ObjectId id = ObjectId.fromString(line + 1);
+				final ObjectId id = ObjectId.fromString(line.substring(1));
 				last = new Ref(Ref.Storage.PACKED, last.getName(), last
 						.getObjectId(), id, true);
 				avail.put(last.getName(), last);
-- 
1.6.2.rc2
Next: Shawn O. Pearce
Message 1 of 2 in “Fix parsing peeled line in packed-ref”
  1. Fix parsing peeled line in packed-refDaniel Cheng (aka SDiZ), Mar 6, 2009
  2. Shawn O. PearceMar 6, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.