-
Notifications
You must be signed in to change notification settings - Fork 280
/
Copy pathGTDiffFile.m
45 lines (34 loc) · 967 Bytes
/
GTDiffFile.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//
// GTDiffFile.m
// ObjectiveGitFramework
//
// Created by Danny Greg on 30/11/2012.
// Copyright (c) 2012 GitHub, Inc. All rights reserved.
//
#import "GTDiffFile.h"
#import "GTOID.h"
@implementation GTDiffFile
- (instancetype)init {
NSAssert(NO, @"Call to an unavailable initializer.");
return nil;
}
- (instancetype)initWithGitDiffFile:(git_diff_file)file {
NSParameterAssert(file.path != NULL);
self = [super init];
if (self == nil) return nil;
NSString *path = @(file.path);
if (path == nil) return nil;
_path = path;
_git_diff_file = file;
_size = (NSUInteger)file.size;
_flags = (GTDiffFileFlag)file.flags;
_mode = file.mode;
return self;
}
- (NSString *)debugDescription {
return [NSString stringWithFormat:@"%@ path: %@, size: %ld, mode: %u, flags: %@", super.debugDescription, self.path, (unsigned long)self.size, self.mode, @(self.flags)];
}
- (GTOID *)OID {
return [[GTOID alloc] initWithGitOid:&_git_diff_file.id];
}
@end