|
27 | 27 | expect(repository).notTo(beNil());
|
28 | 28 | });
|
29 | 29 |
|
30 |
| - void (^updateIndexForSubpathAndExpectStatus)(NSString *, GTStatusDeltaStatus) = ^(NSString *subpath, GTStatusDeltaStatus expectedIndexStatus) { |
| 30 | + void (^updateIndexForSubpathAndExpectStatus)(NSString *, GTDeltaType) = ^(NSString *subpath, GTDeltaType expectedIndexStatus) { |
31 | 31 | __block NSError *err = nil;
|
32 | 32 | GTIndex *index = [repository indexWithError:&err];
|
33 | 33 | expect(err).to(beNil());
|
|
42 | 42 | expect(err).to(beNil());
|
43 | 43 | };
|
44 | 44 |
|
45 |
| - void (^expectSubpathToHaveWorkDirStatus)(NSString *, GTStatusDeltaStatus) = ^(NSString *subpath, GTStatusDeltaStatus expectedWorkDirStatus) { |
| 45 | + void (^expectSubpathToHaveWorkDirStatus)(NSString *, GTDeltaType) = ^(NSString *subpath, GTDeltaType expectedWorkDirStatus) { |
46 | 46 | __block NSError *err = nil;
|
47 | 47 | NSDictionary *renamedOptions = @{ GTRepositoryStatusOptionsFlagsKey: @(GTRepositoryStatusFlagsIncludeIgnored | GTRepositoryStatusFlagsIncludeUntracked | GTRepositoryStatusFlagsRecurseUntrackedDirectories | GTRepositoryStatusFlagsRenamesIndexToWorkingDirectory) };
|
48 | 48 | expect(@([repository enumerateFileStatusWithOptions:renamedOptions error:&err usingBlock:^(GTStatusDelta *headToIndex, GTStatusDelta *indexToWorkingDirectory, BOOL *stop) {
|
|
52 | 52 | expect(err).to(beNil());
|
53 | 53 | };
|
54 | 54 |
|
55 |
| - void (^expectSubpathToHaveMatchingStatus)(NSString *, GTStatusDeltaStatus) = ^(NSString *subpath, GTStatusDeltaStatus status) { |
| 55 | + void (^expectSubpathToHaveMatchingStatus)(NSString *, GTDeltaType) = ^(NSString *subpath, GTDeltaType status) { |
56 | 56 | expectSubpathToHaveWorkDirStatus(subpath, status);
|
57 | 57 | updateIndexForSubpathAndExpectStatus(subpath, status);
|
58 | 58 | };
|
59 | 59 |
|
60 | 60 | it(@"should recognize untracked files", ^{
|
61 |
| - expectSubpathToHaveWorkDirStatus(@"UntrackedImage.png", GTStatusDeltaStatusUntracked); |
| 61 | + expectSubpathToHaveWorkDirStatus(@"UntrackedImage.png", GTDeltaTypeUntracked); |
62 | 62 | });
|
63 | 63 |
|
64 | 64 | it(@"should recognize added files", ^{
|
65 |
| - updateIndexForSubpathAndExpectStatus(@"UntrackedImage.png", GTStatusDeltaStatusAdded); |
| 65 | + updateIndexForSubpathAndExpectStatus(@"UntrackedImage.png", GTDeltaTypeAdded); |
66 | 66 | });
|
67 | 67 |
|
68 | 68 | it(@"should recognize modified files", ^{
|
69 | 69 | expect(@([NSFileManager.defaultManager removeItemAtURL:targetFileURL error:&err])).to(beTruthy());
|
70 | 70 | expect(err).to(beNil());
|
71 | 71 | expect(@([testData writeToURL:targetFileURL atomically:YES])).to(beTruthy());
|
72 |
| - expectSubpathToHaveMatchingStatus(targetFileURL.lastPathComponent, GTStatusDeltaStatusModified); |
| 72 | + expectSubpathToHaveMatchingStatus(targetFileURL.lastPathComponent, GTDeltaTypeModified); |
73 | 73 | });
|
74 | 74 |
|
75 | 75 | it(@"should recognize copied files", ^{
|
76 | 76 | NSURL *copyLocation = [repository.fileURL URLByAppendingPathComponent:@"main2.m"];
|
77 | 77 | expect(@([NSFileManager.defaultManager copyItemAtURL:targetFileURL toURL:copyLocation error:&err])).to(beTruthy());
|
78 | 78 | expect(err).to(beNil());
|
79 |
| - updateIndexForSubpathAndExpectStatus(copyLocation.lastPathComponent, GTStatusDeltaStatusCopied); |
| 79 | + updateIndexForSubpathAndExpectStatus(copyLocation.lastPathComponent, GTDeltaTypeCopied); |
80 | 80 | });
|
81 | 81 |
|
82 | 82 | it(@"should recognize deleted files", ^{
|
83 | 83 | expect(@([NSFileManager.defaultManager removeItemAtURL:targetFileURL error:&err])).to(beTruthy());
|
84 | 84 | expect(err).to(beNil());
|
85 |
| - expectSubpathToHaveMatchingStatus(targetFileURL.lastPathComponent, GTStatusDeltaStatusDeleted); |
| 85 | + expectSubpathToHaveMatchingStatus(targetFileURL.lastPathComponent, GTDeltaTypeDeleted); |
86 | 86 | });
|
87 | 87 |
|
88 | 88 | it(@"should recognize renamed files", ^{
|
89 | 89 | NSURL *moveLocation = [repository.fileURL URLByAppendingPathComponent:@"main-moved.m"];
|
90 | 90 | expect(@([NSFileManager.defaultManager moveItemAtURL:targetFileURL toURL:moveLocation error:&err])).to(beTruthy());
|
91 | 91 | expect(err).to(beNil());
|
92 |
| - expectSubpathToHaveWorkDirStatus(moveLocation.lastPathComponent, GTStatusDeltaStatusRenamed); |
| 92 | + expectSubpathToHaveWorkDirStatus(moveLocation.lastPathComponent, GTDeltaTypeRenamed); |
93 | 93 | });
|
94 | 94 |
|
95 | 95 | it(@"should recognise ignored files", ^{ //at least in the default options
|
96 |
| - expectSubpathToHaveWorkDirStatus(@".DS_Store", GTStatusDeltaStatusIgnored); |
| 96 | + expectSubpathToHaveWorkDirStatus(@".DS_Store", GTDeltaTypeIgnored); |
97 | 97 | });
|
98 | 98 |
|
99 | 99 | it(@"should skip ignored files if asked", ^{
|
100 | 100 | __block NSError *err = nil;
|
101 | 101 | NSDictionary *options = @{ GTRepositoryStatusOptionsFlagsKey: @(0) };
|
102 | 102 | BOOL enumerationSuccessful = [repository enumerateFileStatusWithOptions:options error:&err usingBlock:^(GTStatusDelta *headToIndex, GTStatusDelta *indexToWorkingDirectory, BOOL *stop) {
|
103 |
| - expect(@(indexToWorkingDirectory.status)).notTo(equal(@(GTStatusDeltaStatusIgnored))); |
| 103 | + expect(@(indexToWorkingDirectory.status)).notTo(equal(@(GTDeltaTypeIgnored))); |
104 | 104 | }];
|
105 | 105 | expect(@(enumerationSuccessful)).to(beTruthy());
|
106 | 106 | expect(err).to(beNil());
|
|
0 commit comments