git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Robin Rosenberg <robin.rosenberg.lists@dewire.com>
To: "Shawn O. Pearce" <spearce@spearce.org>
Cc: git@vger.kernel.org
Subject: Re: [JGIT PATCH 4/5] Define Patch to parse a sequence of patch FileHeaders
Date: Thu, 11 Dec 2008 21:39:29 +0100	[thread overview]
Message-ID: <200812112139.29875.robin.rosenberg.lists@dewire.com> (raw)
In-Reply-To: <20081211183954.GH32487@spearce.org>

torsdag 11 december 2008 19:39:54 skrev Shawn O. Pearce:
> Robin Rosenberg <robin.rosenberg.lists@dewire.com> wrote:
> > > +		assertEquals(572, fRepositoryConfigTest.startOffset);
> > > +		assertEquals(1490, fRepositoryConfig.startOffset);
> >
> > 1487 here
> 
> Really?  1490 is the only value that the test vector passes with.
> What's the 3 bytes you think I'm off by?

...Quick, quick, find something else to pick on..  :->

Yes. Very little of the code in TemporaryBuffer is covered by the unit tests
and number of conditionals in there are rather large. I tried messing with
the constants in there to improve that and then PatchTest started to fail.

Here are the changes I tried with. I think it should still work with thes
changes. Rather than changing the other tests, we might want to create
a special test for only the buffer class.

-- robin

diff --git a/org.spearce.jgit/src/org/spearce/jgit/util/TemporaryBuffer.java b/org.spearce.jgit/src/org/spearce/jgit/util/TemporaryBuffer.java
index 27f6444..556ab71 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/util/TemporaryBuffer.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/util/TemporaryBuffer.java
@@ -60,7 +60,7 @@
  * after this stream has been properly closed by {@link #close()}.
  */
 public class TemporaryBuffer extends OutputStream {
-       private static final int DEFAULT_IN_CORE_LIMIT = 1024 * 1024;
+       private static final int DEFAULT_IN_CORE_LIMIT = 1024;

        /** Chain of data, if we are still completely in-core; otherwise null. */
        private ArrayList<Block> blocks;
@@ -315,7 +315,7 @@ public void destroy() {
        }

        private static class Block {
-               static final int SZ = 8 * 1024;
+               static final int SZ = 512;

                final byte[] buffer = new byte[SZ];

  parent reply	other threads:[~2008-12-11 20:41 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-11  4:58 [JGIT PATCH 0/5] Patch parsing API Shawn O. Pearce
2008-12-11  4:58 ` [JGIT PATCH 1/5] Add toByteArray() to TemporaryBuffer Shawn O. Pearce
2008-12-11  4:58   ` [JGIT PATCH 2/5] Add copy(InputStream) " Shawn O. Pearce
2008-12-11  4:58     ` [JGIT PATCH 3/5] Define FileHeader to parse the header block of a git diff Shawn O. Pearce
2008-12-11  4:58       ` [JGIT PATCH 4/5] Define Patch to parse a sequence of patch FileHeaders Shawn O. Pearce
2008-12-11  4:58         ` [JGIT PATCH 5/5] Add HunkHeader to represent a single hunk of a file within a patch Shawn O. Pearce
2008-12-11 18:34         ` [JGIT PATCH 4/5] Define Patch to parse a sequence of patch FileHeaders Robin Rosenberg
2008-12-11 18:39           ` Shawn O. Pearce
2008-12-11 20:23             ` Robin Rosenberg
2008-12-11 20:27               ` Shawn O. Pearce
2008-12-11 20:39             ` Robin Rosenberg [this message]
2008-12-11 20:41               ` Shawn O. Pearce
2008-12-11 15:40     ` [JGIT PATCH 2/5] Add copy(InputStream) to TemporaryBuffer Robin Rosenberg
2008-12-11 15:52       ` Shawn O. Pearce
2008-12-11 16:53         ` [JGIT PATCH 2/5 v2] " Shawn O. Pearce

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=200812112139.29875.robin.rosenberg.lists@dewire.com \
    --to=robin.rosenberg.lists@dewire.com \
    --cc=git@vger.kernel.org \
    --cc=spearce@spearce.org \
    /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).