mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 23:40:18 +00:00
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:
+1
-1
@@ -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
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user