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

Re: [PATCH] [JGit] Fix parsing peeled line in packed-ref

From
Shawn O. Pearce <spearce@spearce.org>
Date
Mar 6, 2009, 15:43 UTC
Message-ID
<20090306154309.GF16213@spearce.org>
In-Reply-To
<1236353138-1427-1-git-send-email-j16sdiz+freenet@sdiz.net>
"Daniel Cheng (aka SDiZ)" <j16sdiz+freenet@gmail.com> wrote:
> When doing a WalkTransport with packed-ref, peeled
> line are not handled correctly. This patch fix the
> issue.
Wow.  That old code was really wrong.  :-)
Signed-off-by?  (See SUBMITTING_PATCHES, "(5) Sign your work")
Show 11 quoted lines
> 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

If I'm at fault for that preimage, I should just be put out to pasture now... before I do any more harm... *sigh*

-- 
Shawn.
Previous: Daniel Cheng (aka SDiZ)
Message 2 of 2 in “[JGit] Fix parsing peeled line in packed-ref”
  1. [JGit] 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.