]> source.dussan.org Git - jgit.git/commitdiff
Make use of Repository.writeMerge...() 97/1197/1
authorChristian Halstrick <christian.halstrick@sap.com>
Thu, 29 Jul 2010 07:09:54 +0000 (09:09 +0200)
committerChristian Halstrick <christian.halstrick@sap.com>
Thu, 29 Jul 2010 13:12:14 +0000 (15:12 +0200)
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>
org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java

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