Skip to content

Add list of files to merge conflict error #538

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 27, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion ObjectiveGit/GTRepository+Pull.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#import "GTRepository+RemoteOperations.h"
#import "GTTree.h"
#import "NSError+Git.h"
#import "GTIndexEntry.h"
#import "git2/errors.h"

@implementation GTRepository (Pull)
Expand Down Expand Up @@ -106,7 +107,17 @@ - (BOOL)pullBranch:(GTBranch *)branch fromRemote:(GTRemote *)remote withOptions:

// Check for conflict
if (index.hasConflicts) {
if (error != NULL) *error = [NSError git_errorFor:GIT_ECONFLICT description:@"Merge conflict, pull aborted"];
NSMutableArray <NSString *>*files = [NSMutableArray array];
[index enumerateConflictedFilesWithError:error usingBlock:^(GTIndexEntry * _Nonnull ancestor, GTIndexEntry * _Nonnull ours, GTIndexEntry * _Nonnull theirs, BOOL * _Nonnull stop) {
[files addObject:ours.path];
}];
if (error != NULL) {
if (files.count > 0) {
*error = [NSError git_errorFor:GIT_ECONFLICT description:@"Merge conflict in files: %@. Pull aborted.", [files componentsJoinedByString:@", "]];
} else {
*error = [NSError git_errorFor:GIT_ECONFLICT description:@"Merge conflict, pull aborted"];
}
}
return NO;
}

Expand Down