Thread (26 messages) flat view 26 messages, 2 authors, 2016-06-15
DORMANTno replies

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

From: Shawn O. Pearce <hidden>
Date: 2016-06-15 22:47:06
Subsystem: the rest · Maintainer: Linus Torvalds

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 <redacted>
---
 .../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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help