Skip to content

Commit deb6e4e

Browse files
authored
Merge pull request #581 from libgit2/dry-delta-types
DRY delta types
2 parents 7febb4f + f7a846e commit deb6e4e

11 files changed

+67
-72
lines changed

ObjectiveGit/GTDiff.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ typedef NS_OPTIONS(NSInteger, GTDiffFindOptionsFlags) {
308308
- (git_diff *)git_diff __attribute__((objc_returns_inner_pointer));
309309

310310
/// The number of deltas of the given type that are contained in the diff.
311-
- (NSUInteger)numberOfDeltasWithType:(GTDiffDeltaType)deltaType;
311+
- (NSUInteger)numberOfDeltasWithType:(GTDeltaType)deltaType;
312312

313313
/// Enumerate the deltas in a diff.
314314
///

ObjectiveGit/GTDiff.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ - (NSUInteger)deltaCount {
234234
return git_diff_num_deltas(self.git_diff);
235235
}
236236

237-
- (NSUInteger)numberOfDeltasWithType:(GTDiffDeltaType)deltaType {
237+
- (NSUInteger)numberOfDeltasWithType:(GTDeltaType)deltaType {
238238
return git_diff_num_deltas_of_type(self.git_diff, (git_delta_t)deltaType);
239239
}
240240

ObjectiveGit/GTDiffDelta.h

+26-21
Original file line numberDiff line numberDiff line change
@@ -17,35 +17,38 @@
1717

1818
/// The type of change that this delta represents.
1919
///
20-
/// GTDiffFileDeltaUnmodified - No Change.
21-
/// GTDiffFileDeltaAdded - The file was added to the index.
22-
/// GTDiffFileDeltaDeleted - The file was removed from the working directory.
23-
/// GTDiffFileDeltaModified - The file was modified.
24-
/// GTDiffFileDeltaRenamed - The file has been renamed.
25-
/// GTDiffFileDeltaCopied - The file was duplicated.
26-
/// GTDiffFileDeltaIgnored - The file was ignored by git.
27-
/// GTDiffFileDeltaUntracked - The file has been added to the working directory
20+
/// GTDeltaTypeUnmodified - No Change.
21+
/// GTDeltaTypeAdded - The file was added to the index.
22+
/// GTDeltaTypeDeleted - The file was removed from the working directory.
23+
/// GTDeltaTypeModified - The file was modified.
24+
/// GTDeltaTypeRenamed - The file has been renamed.
25+
/// GTDeltaTypeCopied - The file was duplicated.
26+
/// GTDeltaTypeIgnored - The file was ignored by git.
27+
/// GTDeltaTypeUntracked - The file has been added to the working directory
2828
/// and is therefore currently untracked.
29-
/// GTDiffFileDeltaTypeChange - The file has changed from a blob to either a
29+
/// GTDeltaTypeTypeChange - The file has changed from a blob to either a
3030
/// submodule, symlink or directory. Or vice versa.
31-
typedef NS_ENUM(NSInteger, GTDiffDeltaType) {
32-
GTDiffFileDeltaUnmodified = GIT_DELTA_UNMODIFIED,
33-
GTDiffFileDeltaAdded = GIT_DELTA_ADDED,
34-
GTDiffFileDeltaDeleted = GIT_DELTA_DELETED,
35-
GTDiffFileDeltaModified = GIT_DELTA_MODIFIED,
36-
GTDiffFileDeltaRenamed = GIT_DELTA_RENAMED,
37-
GTDiffFileDeltaCopied = GIT_DELTA_COPIED,
38-
GTDiffFileDeltaIgnored = GIT_DELTA_IGNORED,
39-
GTDiffFileDeltaUntracked = GIT_DELTA_UNTRACKED,
40-
GTDiffFileDeltaTypeChange = GIT_DELTA_TYPECHANGE,
31+
/// GTDeltaTypeConflicted - The file is conflicted in the working directory.
32+
typedef NS_ENUM(NSInteger, GTDeltaType) {
33+
GTDeltaTypeUnmodified = GIT_DELTA_UNMODIFIED,
34+
GTDeltaTypeAdded = GIT_DELTA_ADDED,
35+
GTDeltaTypeDeleted = GIT_DELTA_DELETED,
36+
GTDeltaTypeModified = GIT_DELTA_MODIFIED,
37+
GTDeltaTypeRenamed = GIT_DELTA_RENAMED,
38+
GTDeltaTypeCopied = GIT_DELTA_COPIED,
39+
GTDeltaTypeIgnored = GIT_DELTA_IGNORED,
40+
GTDeltaTypeUntracked = GIT_DELTA_UNTRACKED,
41+
GTDeltaTypeTypeChange = GIT_DELTA_TYPECHANGE,
42+
GTDeltaTypeUnreadable = GIT_DELTA_UNREADABLE,
43+
GTDeltaTypeConflicted = GIT_DELTA_CONFLICTED,
4144
};
4245

4346
NS_ASSUME_NONNULL_BEGIN
4447

4548
/// A class representing a single change within a diff.
4649
///
4750
/// The change may not be simply a change of text within a given file, it could
48-
/// be that the file was renamed, or added to the index. See `GTDiffDeltaType`
51+
/// be that the file was renamed, or added to the index. See `GTDeltaType`
4952
/// for the types of change represented.
5053
@interface GTDiffDelta : NSObject
5154

@@ -68,7 +71,9 @@ NS_ASSUME_NONNULL_BEGIN
6871
/// The type of change that this delta represents.
6972
///
7073
/// Think "status" as in `git status`.
71-
@property (nonatomic, readonly) GTDiffDeltaType type;
74+
@property (nonatomic, readonly) GTDeltaType type;
75+
76+
@property (nonatomic, readonly, assign) double similarity;
7277

7378
/// Diffs the given blob and data buffer.
7479
///

ObjectiveGit/GTDiffDelta.m

+6-2
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,12 @@ - (GTDiffFile *)newFile {
5656
return [[GTDiffFile alloc] initWithGitDiffFile:self.git_diff_delta.new_file];
5757
}
5858

59-
- (GTDiffDeltaType)type {
60-
return (GTDiffDeltaType)self.git_diff_delta.status;
59+
- (GTDeltaType)type {
60+
return (GTDeltaType)self.git_diff_delta.status;
61+
}
62+
63+
- (double)similarity {
64+
return (double)(self.git_diff_delta.similarity / 100.0);
6165
}
6266

6367
#pragma mark Lifecycle

ObjectiveGit/GTRepository+Status.m

+5-5
Original file line numberDiff line numberDiff line change
@@ -68,23 +68,23 @@ - (BOOL)enumerateFileStatusWithOptions:(NSDictionary *)options error:(NSError **
6868
- (BOOL)isWorkingDirectoryClean {
6969
__block BOOL clean = YES;
7070
[self enumerateFileStatusWithOptions:nil error:NULL usingBlock:^(GTStatusDelta *headToIndex, GTStatusDelta *indexToWorkingDirectory, BOOL *stop) {
71-
GTStatusDeltaStatus headToIndexStatus = headToIndex.status;
72-
GTStatusDeltaStatus indexToWorkDirStatus = indexToWorkingDirectory.status;
71+
GTDeltaType headToIndexStatus = headToIndex.status;
72+
GTDeltaType indexToWorkDirStatus = indexToWorkingDirectory.status;
7373

7474
// first, have items been deleted?
75-
if (indexToWorkDirStatus == GTStatusDeltaStatusDeleted || headToIndexStatus == GTStatusDeltaStatusDeleted) {
75+
if (indexToWorkDirStatus == GTDeltaTypeDeleted || headToIndexStatus == GTDeltaTypeDeleted) {
7676
clean = NO;
7777
*stop = YES;
7878
}
7979

8080
// any untracked files?
81-
if (indexToWorkDirStatus == GTStatusDeltaStatusUntracked) {
81+
if (indexToWorkDirStatus == GTDeltaTypeUntracked) {
8282
clean = NO;
8383
*stop = YES;
8484
}
8585

8686
// next, have items been modified?
87-
if (indexToWorkDirStatus == GTStatusDeltaStatusModified || headToIndexStatus == GTStatusDeltaStatusModified) {
87+
if (indexToWorkDirStatus == GTDeltaTypeModified || headToIndexStatus == GTDeltaTypeModified) {
8888
clean = NO;
8989
*stop = YES;
9090
}

ObjectiveGit/GTStatusDelta.h

+2-16
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,10 @@
88

99
#import <Foundation/Foundation.h>
1010
#import "git2/diff.h"
11+
#import <ObjectiveGit/GTDiffDelta.h>
1112

1213
@class GTDiffFile;
1314

14-
/// An enum representing the status of the file.
15-
///
16-
/// See diff.h for documentation of individual flags.
17-
typedef NS_ENUM(NSInteger, GTStatusDeltaStatus) {
18-
GTStatusDeltaStatusUnmodified = GIT_DELTA_UNMODIFIED,
19-
GTStatusDeltaStatusAdded = GIT_DELTA_ADDED,
20-
GTStatusDeltaStatusDeleted = GIT_DELTA_DELETED,
21-
GTStatusDeltaStatusModified = GIT_DELTA_MODIFIED,
22-
GTStatusDeltaStatusRenamed = GIT_DELTA_RENAMED,
23-
GTStatusDeltaStatusCopied = GIT_DELTA_COPIED,
24-
GTStatusDeltaStatusIgnored = GIT_DELTA_IGNORED,
25-
GTStatusDeltaStatusUntracked = GIT_DELTA_UNTRACKED,
26-
GTStatusDeltaStatusTypeChange = GIT_DELTA_TYPECHANGE,
27-
};
28-
2915
NS_ASSUME_NONNULL_BEGIN
3016

3117
/// Represents the status of a file in a repository.
@@ -38,7 +24,7 @@ NS_ASSUME_NONNULL_BEGIN
3824
@property (nonatomic, readonly, copy, nullable) GTDiffFile *newFile __attribute__((ns_returns_not_retained));
3925

4026
/// The status of the file.
41-
@property (nonatomic, readonly) GTStatusDeltaStatus status;
27+
@property (nonatomic, readonly) GTDeltaType status;
4228

4329
/// A float between 0 and 1 describing how similar the old and new
4430
/// files are (where 0 is not at all and 1 is identical).

ObjectiveGit/GTStatusDelta.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ - (instancetype)initWithGitDiffDelta:(const git_diff_delta *)delta {
2323

2424
_oldFile = [[GTDiffFile alloc] initWithGitDiffFile:delta->old_file];
2525
_newFile = [[GTDiffFile alloc] initWithGitDiffFile:delta->new_file];
26-
_status = (GTStatusDeltaStatus)delta->status;
26+
_status = (GTDeltaType)delta->status;
2727
_similarity = (double)(delta->similarity / 100.0);
2828

2929
return self;

ObjectiveGitTests/GTDiffSpec.m

+5-5
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
setupDiffFromCommitSHAsAndOptions(@"be0f001ff517a00b5b8e3c29ee6561e70f994e17", @"fe89ea0a8e70961b8a6344d9660c326d3f2eb0fe", nil);
9191

9292
expect(@(diff.deltaCount)).to(equal(@1));
93-
expect(@([diff numberOfDeltasWithType:GTDiffFileDeltaModified])).to(equal(@1));
93+
expect(@([diff numberOfDeltasWithType:GTDeltaTypeModified])).to(equal(@1));
9494

9595
[diff enumerateDeltasUsingBlock:^(GTDiffDelta *delta, BOOL *stop) {
9696
NSError *error = nil;
@@ -101,7 +101,7 @@
101101
expect(delta.oldFile.path).to(equal(@"TestAppWindowController.h"));
102102
expect(delta.oldFile.path).to(equal(delta.newFile.path));
103103
expect(@(delta.flags & GTDiffFileFlagBinaryMask)).to(equal(@(GTDiffFileFlagNotBinary)));
104-
expect(@(delta.type)).to(equal(@(GTDiffFileDeltaModified)));
104+
expect(@(delta.type)).to(equal(@(GTDeltaTypeModified)));
105105

106106
expect(patch.delta).to(beIdenticalTo(delta));
107107
expect(@(patch.hunkCount)).to(equal(@1));
@@ -155,7 +155,7 @@
155155
expect(@(diff.deltaCount)).to(equal(@1));
156156
[diff enumerateDeltasUsingBlock:^(GTDiffDelta *delta, BOOL *stop) {
157157
expect(delta.newFile.path).to(equal(@"REAME")); //loltypo
158-
expect(@(delta.type)).to(equal(@(GTDiffFileDeltaAdded)));
158+
expect(@(delta.type)).to(equal(@(GTDeltaTypeAdded)));
159159

160160
*stop = YES;
161161
}];
@@ -166,7 +166,7 @@
166166

167167
expect(@(diff.deltaCount)).to(equal(@1));
168168
[diff enumerateDeltasUsingBlock:^(GTDiffDelta *delta, BOOL *stop) {
169-
expect(@(delta.type)).to(equal(@(GTDiffFileDeltaDeleted)));
169+
expect(@(delta.type)).to(equal(@(GTDeltaTypeDeleted)));
170170

171171
*stop = YES;
172172
}];
@@ -193,7 +193,7 @@
193193

194194
expect(@(diff.deltaCount)).to(equal(@1));
195195
[diff enumerateDeltasUsingBlock:^(GTDiffDelta *delta, BOOL *stop) {
196-
expect(@(delta.type)).to(equal(@(GTDiffFileDeltaRenamed)));
196+
expect(@(delta.type)).to(equal(@(GTDeltaTypeRenamed)));
197197
expect(delta.oldFile.path).to(equal(@"README"));
198198
expect(delta.newFile.path).to(equal(@"README_renamed"));
199199

ObjectiveGitTests/GTIndexSpec.m

+8-8
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@
202202

203203
NSDictionary *renamedOptions = @{ GTRepositoryStatusOptionsFlagsKey: @(GTRepositoryStatusFlagsIncludeIgnored | GTRepositoryStatusFlagsIncludeUntracked | GTRepositoryStatusFlagsRecurseUntrackedDirectories | GTRepositoryStatusFlagsRenamesHeadToIndex | GTRepositoryStatusFlagsIncludeUnmodified) };
204204

205-
BOOL (^fileStatusEqualsExpected)(NSString *filename, GTStatusDeltaStatus headToIndexStatus, GTStatusDeltaStatus indexToWorkingDirectoryStatus) = ^(NSString *filename, GTStatusDeltaStatus headToIndexStatus, GTStatusDeltaStatus indexToWorkingDirectoryStatus) {
205+
BOOL (^fileStatusEqualsExpected)(NSString *filename, GTDeltaType headToIndexStatus, GTDeltaType indexToWorkingDirectoryStatus) = ^(NSString *filename, GTDeltaType headToIndexStatus, GTDeltaType indexToWorkingDirectoryStatus) {
206206
return [index.repository enumerateFileStatusWithOptions:renamedOptions error:NULL usingBlock:^(GTStatusDelta *headToIndex, GTStatusDelta *indexToWorkingDirectory, BOOL *stop) {
207207
if (![headToIndex.newFile.path isEqualToString:filename]) return;
208208
expect(@(headToIndex.status)).to(equal(@(headToIndexStatus)));
@@ -230,32 +230,32 @@
230230
it(@"it preserves decomposed Unicode in index paths with precomposeunicode disabled", ^{
231231
NSString *decomposedFilename = [filename decomposedStringWithCanonicalMapping];
232232
GTIndexEntry *entry = [index entryWithPath:decomposedFilename error:NULL];
233-
expect(@(fileStatusEqualsExpected(entry.path, GTStatusDeltaStatusUnmodified, GTStatusDeltaStatusUnmodified))).to(beTruthy());
233+
expect(@(fileStatusEqualsExpected(entry.path, GTDeltaTypeUnmodified, GTDeltaTypeUnmodified))).to(beTruthy());
234234

235235
expect(@([[NSFileManager defaultManager] moveItemAtURL:fileURL toURL:renamedFileURL error:NULL])).to(beTruthy());
236236

237237
entry = [index entryWithPath:decomposedFilename error:NULL];
238-
expect(@(fileStatusEqualsExpected(entry.path, GTStatusDeltaStatusUnmodified, GTStatusDeltaStatusDeleted))).to(beTruthy());
238+
expect(@(fileStatusEqualsExpected(entry.path, GTDeltaTypeUnmodified, GTDeltaTypeDeleted))).to(beTruthy());
239239

240240
[index removeFile:filename error:NULL];
241241
[index addFile:renamedFilename error:NULL];
242242
[index write:NULL];
243243

244244
entry = [index entryWithPath:[renamedFilename decomposedStringWithCanonicalMapping] error:NULL];
245-
expect(@(fileStatusEqualsExpected(entry.path, GTStatusDeltaStatusRenamed, GTStatusDeltaStatusUnmodified))).to(beTruthy());
245+
expect(@(fileStatusEqualsExpected(entry.path, GTDeltaTypeRenamed, GTDeltaTypeUnmodified))).to(beTruthy());
246246
});
247247

248248
it(@"it preserves precomposed Unicode in index paths with precomposeunicode enabled", ^{
249249
GTIndexEntry *fileEntry = [index entryWithPath:[filename decomposedStringWithCanonicalMapping] error:NULL];
250250
expect(fileEntry).notTo(beNil());
251-
expect(@(fileStatusEqualsExpected(fileEntry.path, GTStatusDeltaStatusUnmodified, GTStatusDeltaStatusUnmodified))).to(beTruthy());
251+
expect(@(fileStatusEqualsExpected(fileEntry.path, GTDeltaTypeUnmodified, GTDeltaTypeUnmodified))).to(beTruthy());
252252

253253
[configuration setBool:true forKey:@"core.precomposeunicode"];
254254
expect(@([configuration boolForKey:@"core.precomposeunicode"])).to(beTruthy());
255255

256256
GTIndexEntry *decomposedFileEntry = [index entryWithPath:[filename decomposedStringWithCanonicalMapping] error:NULL];
257257
expect(decomposedFileEntry).notTo(beNil());
258-
expect(@(fileStatusEqualsExpected(decomposedFileEntry.path, GTStatusDeltaStatusUnmodified, GTStatusDeltaStatusDeleted))).to(beTruthy());
258+
expect(@(fileStatusEqualsExpected(decomposedFileEntry.path, GTDeltaTypeUnmodified, GTDeltaTypeDeleted))).to(beTruthy());
259259

260260
expect(@([[NSFileManager defaultManager] moveItemAtURL:fileURL toURL:renamedFileURL error:NULL])).to(beTruthy());
261261

@@ -264,15 +264,15 @@
264264

265265
decomposedFileEntry = [index entryWithPath:[filename decomposedStringWithCanonicalMapping] error:NULL];
266266
expect(decomposedFileEntry).notTo(beNil());
267-
expect(@(fileStatusEqualsExpected(decomposedFileEntry.path, GTStatusDeltaStatusUnmodified, GTStatusDeltaStatusDeleted))).to(beTruthy());
267+
expect(@(fileStatusEqualsExpected(decomposedFileEntry.path, GTDeltaTypeUnmodified, GTDeltaTypeDeleted))).to(beTruthy());
268268

269269
[index removeFile:filename error:NULL];
270270
[index addFile:renamedFilename error:NULL];
271271
[index write:NULL];
272272

273273
GTIndexEntry *precomposedRenamedFileEntry = [index entryWithPath:renamedFilename error:NULL];
274274
expect(precomposedRenamedFileEntry).notTo(beNil());
275-
expect(@(fileStatusEqualsExpected(precomposedFileEntry.path, GTStatusDeltaStatusRenamed, GTStatusDeltaStatusUntracked))).to(beTruthy());
275+
expect(@(fileStatusEqualsExpected(precomposedFileEntry.path, GTDeltaTypeRenamed, GTDeltaTypeUntracked))).to(beTruthy());
276276
});
277277
});
278278

ObjectiveGitTests/GTRepository+StatusSpec.m

+11-11
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
expect(repository).notTo(beNil());
2828
});
2929

30-
void (^updateIndexForSubpathAndExpectStatus)(NSString *, GTStatusDeltaStatus) = ^(NSString *subpath, GTStatusDeltaStatus expectedIndexStatus) {
30+
void (^updateIndexForSubpathAndExpectStatus)(NSString *, GTDeltaType) = ^(NSString *subpath, GTDeltaType expectedIndexStatus) {
3131
__block NSError *err = nil;
3232
GTIndex *index = [repository indexWithError:&err];
3333
expect(err).to(beNil());
@@ -42,7 +42,7 @@
4242
expect(err).to(beNil());
4343
};
4444

45-
void (^expectSubpathToHaveWorkDirStatus)(NSString *, GTStatusDeltaStatus) = ^(NSString *subpath, GTStatusDeltaStatus expectedWorkDirStatus) {
45+
void (^expectSubpathToHaveWorkDirStatus)(NSString *, GTDeltaType) = ^(NSString *subpath, GTDeltaType expectedWorkDirStatus) {
4646
__block NSError *err = nil;
4747
NSDictionary *renamedOptions = @{ GTRepositoryStatusOptionsFlagsKey: @(GTRepositoryStatusFlagsIncludeIgnored | GTRepositoryStatusFlagsIncludeUntracked | GTRepositoryStatusFlagsRecurseUntrackedDirectories | GTRepositoryStatusFlagsRenamesIndexToWorkingDirectory) };
4848
expect(@([repository enumerateFileStatusWithOptions:renamedOptions error:&err usingBlock:^(GTStatusDelta *headToIndex, GTStatusDelta *indexToWorkingDirectory, BOOL *stop) {
@@ -52,55 +52,55 @@
5252
expect(err).to(beNil());
5353
};
5454

55-
void (^expectSubpathToHaveMatchingStatus)(NSString *, GTStatusDeltaStatus) = ^(NSString *subpath, GTStatusDeltaStatus status) {
55+
void (^expectSubpathToHaveMatchingStatus)(NSString *, GTDeltaType) = ^(NSString *subpath, GTDeltaType status) {
5656
expectSubpathToHaveWorkDirStatus(subpath, status);
5757
updateIndexForSubpathAndExpectStatus(subpath, status);
5858
};
5959

6060
it(@"should recognize untracked files", ^{
61-
expectSubpathToHaveWorkDirStatus(@"UntrackedImage.png", GTStatusDeltaStatusUntracked);
61+
expectSubpathToHaveWorkDirStatus(@"UntrackedImage.png", GTDeltaTypeUntracked);
6262
});
6363

6464
it(@"should recognize added files", ^{
65-
updateIndexForSubpathAndExpectStatus(@"UntrackedImage.png", GTStatusDeltaStatusAdded);
65+
updateIndexForSubpathAndExpectStatus(@"UntrackedImage.png", GTDeltaTypeAdded);
6666
});
6767

6868
it(@"should recognize modified files", ^{
6969
expect(@([NSFileManager.defaultManager removeItemAtURL:targetFileURL error:&err])).to(beTruthy());
7070
expect(err).to(beNil());
7171
expect(@([testData writeToURL:targetFileURL atomically:YES])).to(beTruthy());
72-
expectSubpathToHaveMatchingStatus(targetFileURL.lastPathComponent, GTStatusDeltaStatusModified);
72+
expectSubpathToHaveMatchingStatus(targetFileURL.lastPathComponent, GTDeltaTypeModified);
7373
});
7474

7575
it(@"should recognize copied files", ^{
7676
NSURL *copyLocation = [repository.fileURL URLByAppendingPathComponent:@"main2.m"];
7777
expect(@([NSFileManager.defaultManager copyItemAtURL:targetFileURL toURL:copyLocation error:&err])).to(beTruthy());
7878
expect(err).to(beNil());
79-
updateIndexForSubpathAndExpectStatus(copyLocation.lastPathComponent, GTStatusDeltaStatusCopied);
79+
updateIndexForSubpathAndExpectStatus(copyLocation.lastPathComponent, GTDeltaTypeCopied);
8080
});
8181

8282
it(@"should recognize deleted files", ^{
8383
expect(@([NSFileManager.defaultManager removeItemAtURL:targetFileURL error:&err])).to(beTruthy());
8484
expect(err).to(beNil());
85-
expectSubpathToHaveMatchingStatus(targetFileURL.lastPathComponent, GTStatusDeltaStatusDeleted);
85+
expectSubpathToHaveMatchingStatus(targetFileURL.lastPathComponent, GTDeltaTypeDeleted);
8686
});
8787

8888
it(@"should recognize renamed files", ^{
8989
NSURL *moveLocation = [repository.fileURL URLByAppendingPathComponent:@"main-moved.m"];
9090
expect(@([NSFileManager.defaultManager moveItemAtURL:targetFileURL toURL:moveLocation error:&err])).to(beTruthy());
9191
expect(err).to(beNil());
92-
expectSubpathToHaveWorkDirStatus(moveLocation.lastPathComponent, GTStatusDeltaStatusRenamed);
92+
expectSubpathToHaveWorkDirStatus(moveLocation.lastPathComponent, GTDeltaTypeRenamed);
9393
});
9494

9595
it(@"should recognise ignored files", ^{ //at least in the default options
96-
expectSubpathToHaveWorkDirStatus(@".DS_Store", GTStatusDeltaStatusIgnored);
96+
expectSubpathToHaveWorkDirStatus(@".DS_Store", GTDeltaTypeIgnored);
9797
});
9898

9999
it(@"should skip ignored files if asked", ^{
100100
__block NSError *err = nil;
101101
NSDictionary *options = @{ GTRepositoryStatusOptionsFlagsKey: @(0) };
102102
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)));
104104
}];
105105
expect(@(enumerationSuccessful)).to(beTruthy());
106106
expect(err).to(beNil());

ObjectiveGitTests/GTRepositoryResetSpec.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
countStagedFiles = ^{
2626
__block NSUInteger count = 0;
2727
[repository enumerateFileStatusWithOptions:nil error:NULL usingBlock:^(GTStatusDelta *headToIndex, GTStatusDelta *indexToWorkingDirectory, BOOL *stop) {
28-
if (headToIndex.status != GTStatusDeltaStatusUnmodified) count++;
28+
if (headToIndex.status != GTDeltaTypeUnmodified) count++;
2929
}];
3030

3131
return count;

0 commit comments

Comments
 (0)