Merge branch 'pu/pb/index_quick_fix' into stable
[GitX.git] / PBChangedFile.m
blobac9b4d3fb0d1aff98f8f053714dd34bcf0105196
1 //
2 //  PBChangedFile.m
3 //  GitX
4 //
5 //  Created by Pieter de Bie on 22-09-08.
6 //  Copyright 2008 __MyCompanyName__. All rights reserved.
7 //
9 #import "PBChangedFile.h"
10 #import "PBEasyPipe.h"
12 @implementation PBChangedFile
14 @synthesize path, status, hasStagedChanges, hasUnstagedChanges, commitBlobSHA, commitBlobMode;
16 - (id) initWithPath:(NSString *)p
18         if (![super init])
19                 return nil;
21         path = p;
22         return self;
25 - (NSString *)indexInfo
27         NSAssert(status == NEW || self.commitBlobSHA, @"File is not new, but doesn't have an index entry!");
28         if (!self.commitBlobSHA)
29                 return [NSString stringWithFormat:@"0 0000000000000000000000000000000000000000\t%@\0", self.path];
30         else
31                 return [NSString stringWithFormat:@"%@ %@\t%@\0", self.commitBlobMode, self.commitBlobSHA, self.path];
34 - (NSImage *) icon
36         NSString *filename;
37         switch (status) {
38                 case NEW:
39                         filename = @"new_file";
40                         break;
41                 case DELETED:
42                         filename = @"deleted_file";
43                         break;
44                 default:
45                         filename = @"empty_file";
46                         break;
47         }
48         NSString *p = [[NSBundle mainBundle] pathForResource:filename ofType:@"png"];
49         return [[NSImage alloc] initByReferencingFile: p];
52 + (BOOL)isSelectorExcludedFromWebScript:(SEL)aSelector
54         return NO;
57 + (BOOL)isKeyExcludedFromWebScript:(const char *)name {
58         return NO;
61 @end