mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 23:40:18 +00:00
diffHighlighter: Correctly match unified diff hunks
Hunks in unified diffs are usually in the form of @@ -a,b +x,y @@, but sometimes the ,b (i.e. the range) can be ommitted, in which case our code didn't match the hunk-header at all, resulting in line-numbers off-by-one in commit-view. Signed-off-by: Johannes Gilger <heipei@hackvalue.de>
This commit is contained in:
@@ -203,7 +203,7 @@ var highlightDiff = function(diff, element, callbacks) {
|
||||
header = false;
|
||||
}
|
||||
|
||||
if (m = l.match(/@@ \-([0-9]+),\d+ \+(\d+),\d+ @@/))
|
||||
if (m = l.match(/@@ \-([0-9]+),?\d* \+(\d+),?\d* @@/))
|
||||
{
|
||||
hunk_start_line_1 = parseInt(m[1]) - 1;
|
||||
hunk_start_line_2 = parseInt(m[2]) - 1;
|
||||
|
||||
Reference in New Issue
Block a user