[bugzilla-gnome-org-extensions] Fix a bug with Git version "signatures"
- From: Krzesimir Nowak <krnowak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [bugzilla-gnome-org-extensions] Fix a bug with Git version "signatures"
- Date: Thu, 20 Nov 2014 22:21:47 +0000 (UTC)
commit e2da67e95d596d9062a3f4a19d54b0a9febfb667
Author: Owen W. Taylor <otaylor fishsoup net>
Date: Sat Oct 3 15:50:28 2009 -0400
Fix a bug with Git version "signatures"
All cases for -- \n1.6.2.5' at the end of a Git patch weren't handled
correctly; look for it before ending the last segment not after ending
the last segment, since it shouldn't affect the segment fixup.
js/patch.js | 9 ++++++---
tests/patch.jst | 2 ++
2 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/js/patch.js b/js/patch.js
index 99f221a..3e2e412 100644
--- a/js/patch.js
+++ b/js/patch.js
@@ -133,19 +133,22 @@ Hunk.prototype = {
}
}
- endSegment();
-
// git mail-formatted patches end with --\n<git version> like a signature
// This is troublesome since it looks like a subtraction at the end
// of last hunk of the last file. Handle this specifically rather than
// generically stripping excess lines to be kind to hand-edited patches
if (totalOld > oldCount &&
- ((lines[lines.length - 1][2] & REMOVED) != 0) &&
+ lines[lines.length - 1][1] == null &&
lines[lines.length - 1][0][0] == '-')
{
lines.pop();
+ currentOldCount--;
+ if (currentOldCount == 0 && currentNewCount == 0)
+ currentStart = -1;
}
+ endSegment();
+
this.lines = lines;
},
diff --git a/tests/patch.jst b/tests/patch.jst
index 2b096dc..3032dd7 100644
--- a/tests/patch.jst
+++ b/tests/patch.jst
@@ -196,6 +196,8 @@ index 0000000..4eac5f6
+Some
+Readme
+File
+--
+1.6.2.5
);
assertEquals(<<<
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]