From eb0f40f1d1227381c4ac44389094ac55f4539ec2 Mon Sep 17 00:00:00 2001 From: Piet Brauer Date: Fri, 22 Jan 2016 11:53:36 +0800 Subject: [PATCH] Add list of files to merge conflict error --- ObjectiveGit/GTRepository+Pull.m | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/ObjectiveGit/GTRepository+Pull.m b/ObjectiveGit/GTRepository+Pull.m index 24bbb3e2d..c50810f83 100644 --- a/ObjectiveGit/GTRepository+Pull.m +++ b/ObjectiveGit/GTRepository+Pull.m @@ -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) @@ -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 *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; }