Skip to content
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
Add list of files to merge conflict error
  • Loading branch information
pietbrauer committed Jan 22, 2016
commit eb0f40f1d1227381c4ac44389094ac55f4539ec2
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