diff --git a/html/lib/diffHighlighter.js b/html/lib/diffHighlighter.js
index d1b65ec..d320e1e 100644
--- a/html/lib/diffHighlighter.js
+++ b/html/lib/diffHighlighter.js
@@ -15,7 +15,7 @@ var highlightDiff = function(diff, element, callbacks) {
var start = new Date().getTime();
element.className = "diff"
var content = diff.escapeHTML().replace(/\t/g, " ");;
-
+
var file_index = 0;
var startname = "";
@@ -26,6 +26,9 @@ var highlightDiff = function(diff, element, callbacks) {
var finalContent = "";
var lines = content.split('\n');
var binary = false;
+ var mode_change = false;
+ var old_mode = "";
+ var new_mode = "";
var hunk_start_line_1 = -1;
var hunk_start_line_2 = -1;
@@ -41,7 +44,7 @@ var highlightDiff = function(diff, element, callbacks) {
}
if (callbacks["newfile"])
- callbacks["newfile"](startname, endname, "file_index_" + (file_index - 1));
+ callbacks["newfile"](startname, endname, "file_index_" + (file_index - 1), mode_change, old_mode, new_mode);
var title = startname;
var binaryname = endname;
@@ -65,10 +68,12 @@ var highlightDiff = function(diff, element, callbacks) {
'';
}
else {
- if (callbacks["binaryFile"])
- finalContent += callbacks["binaryFile"](binaryname);
- else
- finalContent += "
Binary file differs
";
+ if (binary) {
+ if (callbacks["binaryFile"])
+ finalContent += callbacks["binaryFile"](binaryname);
+ else
+ finalContent += "Binary file differs
";
+ }
}
finalContent += '';
@@ -91,6 +96,13 @@ var highlightDiff = function(diff, element, callbacks) {
finishContent(); // Finish last file
binary = false;
+ mode_change = false;
+
+ if(match = l.match(/^diff --git (a\/)+(.*) (b\/)+(.*)$/)) { // there are cases when we need to capture filenames from
+ startname = match[2]; // the diff line, like with mode-changes.
+ endname = match[4]; // this can get overwritten later if there is a diff or if
+ } // the file is binary
+
continue;
}
@@ -131,6 +143,17 @@ 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;
diff --git a/html/views/history/history.css b/html/views/history/history.css
index 07c281b..7c1aaf8 100644
--- a/html/views/history/history.css
+++ b/html/views/history/history.css
@@ -145,7 +145,7 @@ div.button
font-size: 60%;
text-align: center;
- width: 50px;
+ width: 70px;
margin-right: 10px;
diff --git a/html/views/history/history.js b/html/views/history/history.js
index d11358d..cf07780 100644
--- a/html/views/history/history.js
+++ b/html/views/history/history.js
@@ -173,9 +173,13 @@ var loadCommit = function(commitObject, currentRef) {
}
var showDiff = function() {
- var newfile = function(name1, name2, id) {
- if (name1 == name2)
- $("files").innerHTML += "changed
" + name1 + "
";
+ var newfile = function(name1, name2, id, mode_change, old_mode, new_mode) {
+ if (name1 == name2) {
+ if (mode_change)
+ $("files").innerHTML += "mode changed
" + name1 + " mode " + old_mode + " → " + new_mode + "
";
+ else
+ $("files").innerHTML += "changed
" + name1 + "
";
+ }
else if (name1 == "/dev/null")
$("files").innerHTML += "created
" + name2 + "
";
else if (name2 == "/dev/null")
@@ -190,8 +194,8 @@ var showDiff = function() {
else
return "Binary file differs";
}
-
- highlightDiff(commit.diff, $("diff"), { "newfile" : newfile, "binaryFile" : binaryDiff});
+
+ highlightDiff(commit.diff, $("diff"), { "newfile" : newfile, "binaryFile" : binaryDiff });
}
var showImage = function(element, filename)