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(), lastIf I'm at fault for that preimage, I should just be put out to pasture now... before I do any more harm... *sigh*
-- Shawn.