From: Mark Struberg <struberg@yahoo.de>
To: Shawn Spearce <spearce@spearce.org>, robin.rosenberg@dewire.com
Cc: git@vger.kernel.org
Subject: [JGIT PATCH] move the 'empty-line' check in RefDatabase#readLine down a bit to after we removed all the whitespaces.
Date: Tue, 1 Sep 2009 21:41:35 +0000 (GMT) [thread overview]
Message-ID: <358677.62716.qm@web27808.mail.ukl.yahoo.com> (raw)
This way we consistently return null regardless if the line is empty or if it does only contain whitespaces.
Signed-off-by: Mark Struberg <struberg@yahoo.de>
---
.../src/org/spearce/jgit/lib/RefDatabase.java | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/RefDatabase.java b/org.spearce.jgit/src/org/spearce/jgit/lib/RefDatabase.java
index 477dc62..acc835b 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/RefDatabase.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/RefDatabase.java
@@ -498,14 +498,15 @@ private static String readLine(final File file)
throws FileNotFoundException, IOException {
final byte[] buf = NB.readFully(file, 4096);
int n = buf.length;
- if (n == 0)
- return null;
// remove trailing whitespaces
while (n > 0 && Character.isWhitespace(buf[n - 1])) {
n--;
}
-
+
+ if (n == 0)
+ return null;
+
return RawParseUtils.decode(buf, 0, n);
}
--
1.6.2.5
reply other threads:[~2009-09-01 21:41 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=358677.62716.qm@web27808.mail.ukl.yahoo.com \
--to=struberg@yahoo.de \
--cc=git@vger.kernel.org \
--cc=robin.rosenberg@dewire.com \
--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