Skip to content

Commit 5492126

Browse files
committed
Add merge conflicted files to user info
1 parent bc11b50 commit 5492126

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

ObjectiveGit/GTRepository+Pull.m

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
#import "GTIndexEntry.h"
2121
#import "git2/errors.h"
2222

23+
NSString * const GTPullMergeConflictedFiles = @"GTPullMergeConflictedFiles";
24+
2325
@implementation GTRepository (Pull)
2426

2527
#pragma mark - Pull
@@ -112,11 +114,8 @@ - (BOOL)pullBranch:(GTBranch *)branch fromRemote:(GTRemote *)remote withOptions:
112114
[files addObject:ours.path];
113115
}];
114116
if (error != NULL) {
115-
if (files.count > 0) {
116-
*error = [NSError git_errorFor:GIT_ECONFLICT description:@"Merge conflict in files: %@. Pull aborted.", [files componentsJoinedByString:@", "]];
117-
} else {
118-
*error = [NSError git_errorFor:GIT_ECONFLICT description:@"Merge conflict, pull aborted"];
119-
}
117+
NSDictionary *userInfo = @{GTPullMergeConflictedFiles: files};
118+
*error = [NSError git_errorFor:GIT_ECONFLICT description:@"Merge conflict, Pull aborted." userInfo:userInfo failureReason:nil];
120119
}
121120
return NO;
122121
}

ObjectiveGitTests/GTRepository+PullSpec.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,9 @@
257257
transferProgressed = YES;
258258
}];
259259
expect(@(result)).to(beFalsy());
260-
expect(error).toNot(beNil());
260+
expect(error.domain).to(equal(@"GTGitErrorDomain"));
261+
expect(error.userInfo[@"GTPullMergeConflictedFiles"]).to(equal(@[@"test.txt"]));
262+
expect(error.localizedDescription).to(equal(@"Merge conflict, Pull aborted."));
261263
expect(@(transferProgressed)).to(beTruthy());
262264
});
263265

0 commit comments

Comments
 (0)