mirror of
https://github.com/klaussilveira/gitlist.git
synced 2025-11-18 03:30:55 +01:00
Merge pull request #481 from mikedld/diff-lines
Correct new line numbers in diff viewer
This commit is contained in:
@@ -169,9 +169,9 @@ class Repository extends BaseRepository
|
||||
switch ($log[0]) {
|
||||
case "@":
|
||||
// Set the line numbers
|
||||
preg_match('/@@ -([0-9]+)/', $log, $matches);
|
||||
preg_match('/@@ -([0-9]+)(?:,[0-9]+)? \+([0-9]+)/', $log, $matches);
|
||||
$lineNumOld = $matches[1] - 1;
|
||||
$lineNumNew = $matches[1] - 1;
|
||||
$lineNumNew = $matches[2] - 1;
|
||||
break;
|
||||
case "-":
|
||||
$lineNumOld++;
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
<td class="lineNo">
|
||||
{% if line.getType != 'chunk' %}
|
||||
<a name="L{{ loop.index }}R{{ line.getNumOld }}"></a>
|
||||
<a href="#L{{ loop.index }}L{{ line.getNumOld }}">
|
||||
<a href="#L{{ loop.index }}R{{ line.getNumOld }}">
|
||||
{% endif %}
|
||||
{{ line.getNumOld }}
|
||||
{% if line.getType != 'chunk' %}
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
<td class="lineNo">
|
||||
{% if line.getType != 'chunk' %}
|
||||
<a name="L{{ loop.index }}R{{ line.getNumOld }}"></a>
|
||||
<a href="#L{{ loop.index }}L{{ line.getNumOld }}">
|
||||
<a href="#L{{ loop.index }}R{{ line.getNumOld }}">
|
||||
{% endif %}
|
||||
{{ line.getNumOld }}
|
||||
{% if line.getType != 'chunk' %}
|
||||
|
||||
Reference in New Issue
Block a user