summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorRobin Stocker <robin@nibor.org>2011-04-06 22:55:10 +0200
committerRobin Stocker <robin@nibor.org>2011-04-06 22:57:49 +0200
commit5dbef3fa51053b37f68b44ed390cab6dc8336dcc (patch)
tree3c45c0394a561fc091c1ad0c2239f10ef9d8b1e0 /org.eclipse.jgit
parent3151657404859454bdf60345c09b536d1269c0c8 (diff)
downloadjgit-5dbef3fa51053b37f68b44ed390cab6dc8336dcc.tar.gz
jgit-5dbef3fa51053b37f68b44ed390cab6dc8336dcc.zip
Add "Conflicts" section to merge message on conflict
The same as with cherry-pick, the commit message of a merge should include a "Conflicts" section when the merge resulted in conflicts. Change-Id: I6261dc898262322924af5ca1bef841a654b0df55 Signed-off-by: Robin Stocker <robin@nibor.org>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java14
1 files changed, 11 insertions, 3 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java
index 39c079896b..5e77565562 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java
@@ -189,14 +189,16 @@ public class MergeCommand extends GitCommand<MergeResult> {
mergeStrategy, null, null);
} else {
- repo.writeMergeCommitMsg(new MergeMessageFormatter().format(
- commits, head));
+ String mergeMessage = new MergeMessageFormatter().format(
+ commits, head);
+ repo.writeMergeCommitMsg(mergeMessage);
repo.writeMergeHeads(Arrays.asList(ref.getObjectId()));
ThreeWayMerger merger = (ThreeWayMerger) mergeStrategy
.newMerger(repo);
boolean noProblems;
Map<String, org.eclipse.jgit.merge.MergeResult<?>> lowLevelResults = null;
Map<String, MergeFailureReason> failingPaths = null;
+ List<String> unmergedPaths = null;
if (merger instanceof ResolveMerger) {
ResolveMerger resolveMerger = (ResolveMerger) merger;
resolveMerger.setCommitNames(new String[] {
@@ -206,6 +208,7 @@ public class MergeCommand extends GitCommand<MergeResult> {
lowLevelResults = resolveMerger
.getMergeResults();
failingPaths = resolveMerger.getFailingPaths();
+ unmergedPaths = resolveMerger.getUnmergedPaths();
} else
noProblems = merger.merge(headCommit, srcCommit);
@@ -230,13 +233,18 @@ public class MergeCommand extends GitCommand<MergeResult> {
headCommit.getId(), srcCommit.getId() },
MergeStatus.FAILED, mergeStrategy,
lowLevelResults, failingPaths, null);
- } else
+ } else {
+ String mergeMessageWithConflicts = new MergeMessageFormatter()
+ .formatWithConflicts(mergeMessage,
+ unmergedPaths);
+ repo.writeMergeCommitMsg(mergeMessageWithConflicts);
return new MergeResult(null,
merger.getBaseCommit(0, 1),
new ObjectId[] { headCommit.getId(),
srcCommit.getId() },
MergeStatus.CONFLICTING, mergeStrategy,
lowLevelResults, null);
+ }
}
}
} catch (IOException e) {