[JGIT PATCH 17/19] Move repository config creation fully into Repository class

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Rather than having the core properties initialized in two different
locations its cleaner to do all of the setup work here in one place,
in case we need to make any further changes to the repository create
code path.

Signed-off-by: Shawn O. Pearce <spearce@xxxxxxxxxxx>
---
 .../src/org/spearce/jgit/lib/Repository.java       |    5 ++---
 .../src/org/spearce/jgit/lib/RepositoryConfig.java |    9 ---------
 2 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java b/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java
index 7fb1ef7..468cf4c 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java
@@ -144,8 +144,6 @@ public Repository(final File d) throws IOException {
 				throw new IOException("Unknown repository format \""
 						+ repositoryFormatVersion + "\"; expected \"0\".");
 			}
-		} else {
-			getConfig().create();
 		}
 	}
 
@@ -185,7 +183,8 @@ public void create(boolean bare) throws IOException {
 		final String master = Constants.R_HEADS + Constants.MASTER;
 		refs.link(Constants.HEAD, master);
 
-		cfg.create();
+		cfg.setInt("core", null, "repositoryformatversion", 0);
+		cfg.setBoolean("core", null, "filemode", true);
 		if (bare)
 			cfg.setBoolean("core", null, "bare", true);
 		cfg.save();
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/RepositoryConfig.java b/org.spearce.jgit/src/org/spearce/jgit/lib/RepositoryConfig.java
index 15fe9de..ccfe184 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/RepositoryConfig.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/RepositoryConfig.java
@@ -123,13 +123,4 @@ public String getAuthorEmail() {
 	public String getCommitterEmail() {
 		return getUserConfig().getCommitterEmail();
 	}
-
-	/**
-	 * Create a new default config
-	 */
-	public void create() {
-		clear();
-		setInt("core", null, "repositoryformatversion", 0);
-		setBoolean("core", null, "filemode", true);
-	}
 }
-- 
1.6.4.rc2.216.g769fa

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]