<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -145,7 +145,16 @@ public class CommitBuilder extends ClientBuilder {
      */
     public void write() throws IOException {
         index.write();
-        doCommit(index.writeTree());
+        final RefUpdate ru = repository.updateRef(Constants.HEAD);
+        ObjectId[] parentIds;
+        if (ru.getOldObjectId() != null)
+            parentIds = new ObjectId[]{ru.getOldObjectId()};
+        else
+            parentIds = new ObjectId[0];
+
+        ObjectId id = writeCommit(index.writeTree(), parentIds);
+        if (!updateRef(ru, id))
+            logger.output(&quot;Failed to update &quot; + ru.getName() + &quot; to commit &quot; + id + &quot;.&quot;);
     }
 
     private ObjectId writeCommit(ObjectId treeId, ObjectId[] parentIds) throws IOException {
@@ -179,19 +188,4 @@ public class CommitBuilder extends ClientBuilder {
         return &quot;\tcommit: &quot; + firstLine;
     }
 
-    private void doCommit(ObjectId treeId) throws IOException {
-            final RefUpdate ru = repository.updateRef(Constants.HEAD);
-            ObjectId[] parentIds;
-            if (ru.getOldObjectId() != null) {
-                parentIds = new ObjectId[]{ru.getOldObjectId()};
-            } else {
-                parentIds = new ObjectId[0];
-            }
-            ObjectId id = writeCommit(treeId, parentIds);
-
-            if (!updateRef(ru, id)) {
-                logger.output(&quot;Failed to update &quot; + ru.getName() + &quot; to commit &quot; + id + &quot;.&quot;);
-            }
-    }
-
 }</diff>
      <filename>src/org/nbgit/client/CommitBuilder.java</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>b2ec7c720b6c9f50e7ccf582cd621845cbf23861</id>
    </parent>
  </parents>
  <author>
    <name>Jonas Fonseca</name>
    <email>fonseca@diku.dk</email>
  </author>
  <url>http://github.com/myabc/nbgit/commit/c49e43036f79fe52092699336f4f6a2d7a209b64</url>
  <id>c49e43036f79fe52092699336f4f6a2d7a209b64</id>
  <committed-date>2009-09-13T18:06:59-07:00</committed-date>
  <authored-date>2009-09-11T06:06:39-07:00</authored-date>
  <message>Issue 20: Refactor doCommit into CommitBuilder.write

Signed-off-by: Jonas Fonseca &lt;fonseca@diku.dk&gt;</message>
  <tree>fd94fac202a7748a21e04ca9240a8baf29ae61fb</tree>
  <committer>
    <name>Jonas Fonseca</name>
    <email>fonseca@diku.dk</email>
  </committer>
</commit>
