Browse Source

Make use of Repository.writeMerge...()

The CommitCommand should not use java.io to delete MERGE_HEAD and MERGE_MSG
files since Repository already has utility methods for that.

Change-Id: If66a419349b95510e5b5c2237a91f06c1d5ba0d4
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
stable-0.9
Christian Halstrick 15 years ago
parent
commit
94207f0a43
  1. 9
      org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java

9
org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java

@ -42,7 +42,6 @@
*/ */
package org.eclipse.jgit.api; package org.eclipse.jgit.api;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.LinkedList; import java.util.LinkedList;
@ -174,13 +173,11 @@ public class CommitCommand extends GitCommand<RevCommit> {
case NEW: case NEW:
case FAST_FORWARD: { case FAST_FORWARD: {
setCallable(false); setCallable(false);
File meta = repo.getDirectory(); if (state == RepositoryState.MERGING_RESOLVED) {
if (state == RepositoryState.MERGING_RESOLVED
&& meta != null) {
// Commit was successful. Now delete the files // Commit was successful. Now delete the files
// used for merge commits // used for merge commits
new File(meta, Constants.MERGE_HEAD).delete(); repo.writeMergeCommitMsg(null);
new File(meta, Constants.MERGE_MSG).delete(); repo.writeMergeHeads(null);
} }
return revCommit; return revCommit;
} }

Loading…
Cancel
Save