Skip to content

Commit b5bf9e0

Browse files
committed
Use the message left by the merge machinery as our commit message
1 parent 00340e9 commit b5bf9e0

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

ObjectiveGit/GTRepository+Merging.m

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,16 @@ - (BOOL)mergeBranchIntoCurrentBranch:(GTBranch *)branch withError:(NSError **)er
223223
}
224224

225225
// Create merge commit
226-
NSString *message = [NSString stringWithFormat:@"Merge branch '%@'", localBranch.shortName];
227-
NSArray *parents = @[ localCommit, remoteCommit ];
226+
NSError *mergeMsgError = nil;
227+
NSURL *mergeMsgFile = [[self gitDirectoryURL] URLByAppendingPathComponent:@"MERGE_MSG"];
228+
NSString *message = [NSString stringWithContentsOfURL:mergeMsgFile
229+
encoding:NSUTF8StringEncoding
230+
error:&mergeMsgError];
231+
if (!message) {
232+
message = [NSString stringWithFormat:@"Merge branch '%@'", localBranch.shortName];
233+
}
228234

235+
NSArray *parents = @[ localCommit, remoteCommit ];
229236
GTCommit *mergeCommit = [self createCommitWithTree:mergedTree message:message parents:parents updatingReferenceNamed:localBranch.reference.name error:error];
230237
if (!mergeCommit) {
231238
return NO;

0 commit comments

Comments
 (0)