##// END OF EJS Templates
patch: fix segfault against unified diffs which start line is zero...
Yuya Nishihara -
r16650:fcb97d9a stable
parent child Browse files
Show More
@@ -1014,9 +1014,9 b' class hunk(object):'
1014 oldstart = self.starta + top
1014 oldstart = self.starta + top
1015 newstart = self.startb + top
1015 newstart = self.startb + top
1016 # zero length hunk ranges already have their start decremented
1016 # zero length hunk ranges already have their start decremented
1017 if self.lena:
1017 if self.lena and oldstart > 0:
1018 oldstart -= 1
1018 oldstart -= 1
1019 if self.lenb:
1019 if self.lenb and newstart > 0:
1020 newstart -= 1
1020 newstart -= 1
1021 return old, oldstart, new, newstart
1021 return old, oldstart, new, newstart
1022
1022
@@ -997,6 +997,26 b' import a unified diff with no lines of c'
997 c3
997 c3
998 c4
998 c4
999
999
1000 no segfault while importing a unified diff which start line is zero but chunk
1001 size is non-zero
1002
1003 $ hg init startlinezero
1004 $ cd startlinezero
1005 $ echo foo > foo
1006 $ hg commit -Amfoo
1007 adding foo
1008
1009 $ hg import --no-commit - << EOF
1010 > diff a/foo b/foo
1011 > --- a/foo
1012 > +++ b/foo
1013 > @@ -0,1 +0,1 @@
1014 > foo
1015 > EOF
1016 applying patch from stdin
1017
1018 $ cd ..
1019
1000 Test corner case involving fuzz and skew
1020 Test corner case involving fuzz and skew
1001
1021
1002 $ hg init morecornercases
1022 $ hg init morecornercases
General Comments 0
You need to be logged in to leave comments. Login now