[JGIT PATCH 07/12] Allow a stray LF at the end of a hunk

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If a hunk ends and is followed by a stray LF its not worth creating
a warning for.  A single extra blank line isn't all that interesting
relative to the other sorts of data we might find at the end of a
patch hunk.

Signed-off-by: Shawn O. Pearce <spearce@xxxxxxxxxxx>
---
 .../src/org/spearce/jgit/patch/Patch.java          |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/org.spearce.jgit/src/org/spearce/jgit/patch/Patch.java b/org.spearce.jgit/src/org/spearce/jgit/patch/Patch.java
index 05d034d..51f1fe5 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/patch/Patch.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/patch/Patch.java
@@ -287,9 +287,16 @@ private int parseHunks(final FileHeader fh, int c, final int end) {
 				c = h.parseBody(this, end);
 				h.endOffset = c;
 				fh.addHunk(h);
-				if (c < end && buf[c] != '@' && buf[c] != 'd'
-						&& match(buf, c, SIG_FOOTER) < 0) {
-					warn(buf, c, "Unexpected hunk trailer");
+				if (c < end) {
+					switch (buf[c]) {
+					case '@':
+					case 'd':
+					case '\n':
+						break;
+					default:
+						if (match(buf, c, SIG_FOOTER) < 0)
+							warn(buf, c, "Unexpected hunk trailer");
+					}
 				}
 				continue;
 			}
-- 
1.6.1.rc2.306.ge5d5e

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux