[JGIT PATCH 08/12] Fix HunkHeader start line when parsing "@@ -1 +1 @@" style headers
- From
Shawn O. Pearce <spearce@spearce.org>
- Date
- Dec 12, 2008, 22:05 UTC
- Message-ID
- <1229119558-1293-9-git-send-email-spearce@spearce.org>
- In-Reply-To
- <1229119558-1293-8-git-send-email-spearce@spearce.org>
In this case we are listing a delta of 1 line but also the position start is line 1.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org> --- .../src/org/spearce/jgit/patch/HunkHeader.java | 12 ++++-------- 1 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/org.spearce.jgit/src/org/spearce/jgit/patch/HunkHeader.java b/org.spearce.jgit/src/org/spearce/jgit/patch/HunkHeader.java index 842519e..f543aed 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/patch/HunkHeader.java +++ b/org.spearce.jgit/src/org/spearce/jgit/patch/HunkHeader.java @@ -152,18 +152,14 @@ void parseHeader(final int end) { old.startLine = -parseBase10(buf, ptr.value, ptr); if (buf[ptr.value] == ',') old.lineCount = parseBase10(buf, ptr.value + 1, ptr); - else { - old.lineCount = old.startLine; - old.startLine = 0; - } + else + old.lineCount = 1; newStartLine = parseBase10(buf, ptr.value + 1, ptr); if (buf[ptr.value] == ',') newLineCount = parseBase10(buf, ptr.value + 1, ptr); - else { - newLineCount = newStartLine; - newStartLine = 0; - } + else + newLineCount = 1; } int parseBody(final Patch script, final int end) {
-- 1.6.1.rc2.306.ge5d5e