##// END OF EJS Templates
diff: fix obscure off-by-one error in diff -p
Dirkjan Ochtman -
r7436:07faba78 default
parent child Browse files
Show More
@@ -160,7 +160,7 b' def bunidiff(t1, t2, l1, l2, header1, he'
160 if opts.showfunc:
160 if opts.showfunc:
161 # walk backwards from the start of the context
161 # walk backwards from the start of the context
162 # to find a line starting with an alphanumeric char.
162 # to find a line starting with an alphanumeric char.
163 for x in xrange(astart, -1, -1):
163 for x in xrange(astart - 1, -1, -1):
164 t = l1[x].rstrip()
164 t = l1[x].rstrip()
165 if funcre.match(t):
165 if funcre.match(t):
166 func = ' ' + t[:40]
166 func = ' ' + t[:40]
@@ -44,6 +44,15 b' hg diff --nodates -U 1'
44 echo '% invalid diff.unified'
44 echo '% invalid diff.unified'
45 hg --config diff.unified=foo diff --nodates
45 hg --config diff.unified=foo diff --nodates
46
46
47 exit 0
47 echo % test off-by-one error with diff -p
48 hg init diffp
49 cd diffp
50 echo a > a
51 hg ci -Ama
52 rm a
53 echo b > a
54 echo a >> a
55 echo c >> a
56 hg diff -U0 -p
48
57
49
58 exit 0
General Comments 0
You need to be logged in to leave comments. Login now