diff --git a/html/lib/diffHighlighter.js b/html/lib/diffHighlighter.js index 23ef488..fbc32a8 100644 --- a/html/lib/diffHighlighter.js +++ b/html/lib/diffHighlighter.js @@ -67,10 +67,12 @@ var highlightDiff = function(diff, element, callbacks) { return; // so printing the filename in the file-list is enough } - finalContent += '
' + - '
' + title + '
'; + if (diffContent != "" || binary) { + finalContent += '
' + + '
' + title + '
'; + } - if (!binary) { + if (!binary && (diffContent != "")) { finalContent += '
' + '
' + line1 + "
" + '
' + line2 + "
" + @@ -86,7 +88,8 @@ var highlightDiff = function(diff, element, callbacks) { } } - finalContent += '
'; + if (diffContent != "" || binary) + finalContent += '
'; line1 = ""; line2 = ""; @@ -120,8 +123,21 @@ var highlightDiff = function(diff, element, callbacks) { if (firstChar == "n") { if (l.match(/^new file mode .*$/)) startname = "/dev/null"; + + if (match = l.match(/^new mode (.*)$/)) { + mode_change = true; + new_mode = match[1]; + } continue; } + if (firstChar == "o") { + if (match = l.match(/^old mode (.*)$/)) { + mode_change = true; + old_mode = match[1]; + } + continue; + } + if (firstChar == "d") { if (l.match(/^deleted file mode .*$/)) endname = "/dev/null"; @@ -163,17 +179,6 @@ var highlightDiff = function(diff, element, callbacks) { } } - if (match = l.match(/^old mode (.*)$/)) { - mode_change = true; - old_mode = match[1]; - } - - if (match = l.match(/^new mode (.*)$/)) { - mode_change = true; - new_mode = match[1]; - } - - // Finish the header if (firstChar == "@") header = false;