CommitView: Handle new files better

This fixes the 'cat' command that was acting up and also shows
information when a file could not be displayed
This commit is contained in:
Pieter de Bie
2008-09-25 23:45:14 +02:00
parent d58127e6a2
commit 001b6bf10e
2 changed files with 8 additions and 2 deletions
+1 -1
View File
@@ -23,7 +23,7 @@
- (NSString *) changes
{
if (status == NEW)
return [PBEasyPipe outputForCommand:@"/bin/cat" withArgs:[NSArray arrayWithObjects:@"cat-file", @"blob", path, nil] inDir:[repository workingDirectory]];
return [PBEasyPipe outputForCommand:@"/bin/cat" withArgs:[NSArray arrayWithObject:path] inDir:[repository workingDirectory]];
else {
if (cached == YES)
return [repository outputInWorkdirForArguments:[NSArray arrayWithObjects:@"diff", @"--cached", @"--", path, nil]];
+7 -1
View File
@@ -8,9 +8,15 @@
<script src="diff.js" type="text/javascript" charset="utf-8"></script>
<script>
var showFileChanges = function(file) {
// New file?
if (file.status == 0)
{
$("diff").innerHTML = file.changes();
var contents = file.changes();
if (contents)
$("diff").innerHTML = contents;
else
$("diff").innerHTML = "Could not display changes";
$("diff").show();
$('title').innerHTML = "New file: " + file.path;
} else {