DiffHighlighter: Properly show binary changes

Binary changes don't have a +++ / --- line, just like
a 100% rename doesn't show any changes. We work around
this in much the same way -- by reading the filenames
for that specific case.
This commit is contained in:
Pieter de Bie
2009-01-25 21:45:28 +00:00
parent cf14746bda
commit b44b0df75a
+10 -3
View File
@@ -63,7 +63,7 @@ var highlightDiff = function(diff, element, callbacks) {
}
else {
if (callbacks["binaryFile"])
finalContent += callbacks["binaryFile"](filename);
finalContent += callbacks["binaryFile"](startname);
else
finalContent += "<div>Binary file differs</div>";
}
@@ -115,10 +115,17 @@ var highlightDiff = function(diff, element, callbacks) {
}
continue;
}
if (firstChar == "B") // "Binary files"
if (firstChar == "B") // "Binary files .. and .. differ"
{
binary = true;
Controller.log_("Binary file");
// We might not have a diff from the binary file if it's new.
// So, we use a regex to figure that out
if (match = l.match(/^Binary files (a\/)?(.*) and (b\/)(.*) differ$/))
{
startname = match[2];
endname = match[4];
}
}
// Finish the header