]> source.dussan.org Git - jgit.git/commitdiff
Add FileRepository(String) convenience constructor 22/1322/2
authorKetan Padegaonkar <KetanPadegaonkar@gmail.com>
Tue, 17 Aug 2010 02:41:54 +0000 (19:41 -0700)
committerShawn O. Pearce <spearce@spearce.org>
Wed, 18 Aug 2010 23:30:20 +0000 (16:30 -0700)
Add a convenience API in FileRepository to pass in a String that
points to the GIT_DIR location.  This is converted to a File and
sent through the usual constructor.

Change-Id: I588388f37e89b8c690020f110a1bc59f46170c40

org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileRepository.java

index 69cce71cf0819ebf64f916f1d79bb5dd9f1c53ad..9ee1e605e255a5acb1fa4ec2b5b00a746665a1ea 100644 (file)
@@ -123,6 +123,20 @@ public class FileRepository extends Repository {
                this(new FileRepositoryBuilder().setGitDir(gitDir).setup());
        }
 
+       /**
+        * A convenience API for {@link #FileRepository(File)}.
+        *
+        * @param gitDir
+        *            GIT_DIR (the location of the repository metadata).
+        * @throws IOException
+        *             the repository appears to already exist but cannot be
+        *             accessed.
+        * @see FileRepositoryBuilder
+        */
+       public FileRepository(final String gitDir) throws IOException {
+               this(new File(gitDir));
+       }
+
        /**
         * Create a repository using the local file system.
         *