package org.dstadler.jgit.porcelain;

import java.io.File;
import java.io.IOException;

import org.dstadler.jgit.helper.CookbookHelper;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.lib.Repository;



/**
 * Simple snippet which shows how to commit all files
 *
 * @author dominik.stadler@gmx.at
 */
public class CommitAll {

    public static void main(String[] args) throws IOException, GitAPIException {
        // prepare a new test-repository
        try (Repository repository = CookbookHelper.createNewRepository()) {
            try (Git git = new Git(repository)) {
                // create the file
                File myfile = new File(repository.getDirectory().getParent(), "testfile");
                myfile.createNewFile();
        
                // and then commit the changes
                git.commit()
                		.setAll(true)
                        .setMessage("Commit all")
                        .call();
        
                System.out.println("Committed all changes to repository at " + repository.getDirectory());
            }
        }
    }
}

@@ -79,16 +79,44 @@
 ception;
+%0Aimport java.io.PrintWriter;
 %0A%0Aimport
@@ -824,16 +824,138 @@
 wFile();
+%0A%0A                // Stage all files in the repo including new files%0A                git.add().addFilepattern(%22.%22).call();
 %0A       
@@ -1002,16 +1002,17 @@
  changes
+.
 %0A       
@@ -1053,10 +1053,388 @@
     
+        
-%09%09
+.setMessage(%22Commit all changes including additions%22)%0A                        .call();%0A%0A                try(PrintWriter writer = new PrintWriter(myfile)) %7B%0A                    writer.append(%22Hello, world!%22);%0A                %7D%0A%0A                // Stage all changed files, omitting new files, and commit with one command%0A                git.commit()%0A                        
 .set
@@ -1487,19 +1487,36 @@
 %22Commit 
-all
+changes to all files
 %22)%0A     
@@ -1535,32 +1535,33 @@
        .call();%0A
+%0A
         %0A       

Fix CommitAll.java example