aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Zarna2012-01-02 07:24:36 (EST)
committerMatthias Sohn2012-01-02 07:24:36 (EST)
commit5d95cd9418a20ff72930d4549429d778181eb9ed (patch)
tree7052a6b8e05edf6e87bc05e8a27f8142cb0437ed
parent617c5d91da98a09d94b012b4547164bebbf290d1 (diff)
downloadjgit-5d95cd9418a20ff72930d4549429d778181eb9ed.zip
jgit-5d95cd9418a20ff72930d4549429d778181eb9ed.tar.gz
jgit-5d95cd9418a20ff72930d4549429d778181eb9ed.tar.bz2
Add constant for default name for the Git repo configurationrefs/changes/97/4897/2
Change-Id: I5a6ef686c444fb1e46c9f784bad01165471ef372 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/RepositorySetupWorkDirTest.java2
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/T0003_BasicTest.java4
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/OpenSshConfigTest.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/BaseRepositoryBuilder.java2
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileRepository.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/OpenSshConfig.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkPushConnection.java2
8 files changed, 14 insertions, 9 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/RepositorySetupWorkDirTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/RepositorySetupWorkDirTest.java
index 8affb01..f98ae49 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/RepositorySetupWorkDirTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/RepositorySetupWorkDirTest.java
@@ -211,7 +211,7 @@ public class RepositorySetupWorkDirTest extends LocalDiskRepositoryTestCase {
private FileBasedConfig configFor(File gitDir) throws IOException,
ConfigInvalidException {
- File configPath = new File(gitDir, "config");
+ File configPath = new File(gitDir, Constants.CONFIG);
FileBasedConfig cfg = new FileBasedConfig(configPath, FS.DETECTED);
cfg.load();
return cfg;
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/T0003_BasicTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/T0003_BasicTest.java
index 408bb93..4ed04ef 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/T0003_BasicTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/T0003_BasicTest.java
@@ -326,7 +326,7 @@ public class T0003_BasicTest extends SampleDataRepositoryTestCase {
@Test
public void test006_ReadUglyConfig() throws IOException,
ConfigInvalidException {
- final File cfg = new File(db.getDirectory(), "config");
+ final File cfg = new File(db.getDirectory(), Constants.CONFIG);
final FileBasedConfig c = new FileBasedConfig(cfg, db.getFS());
final String configStr = " [core];comment\n\tfilemode = yes\n"
+ "[user]\n"
@@ -361,7 +361,7 @@ public class T0003_BasicTest extends SampleDataRepositoryTestCase {
@Test
public void test008_FailOnWrongVersion() throws IOException {
- final File cfg = new File(db.getDirectory(), "config");
+ final File cfg = new File(db.getDirectory(), Constants.CONFIG);
final String badvers = "ihopethisisneveraversion";
final String configStr = "[core]\n" + "\trepositoryFormatVersion="
+ badvers + "\n";
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/OpenSshConfigTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/OpenSshConfigTest.java
index 67123a4..c079234 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/OpenSshConfigTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/OpenSshConfigTest.java
@@ -52,6 +52,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
+import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.RepositoryTestCase;
import org.eclipse.jgit.transport.OpenSshConfig.Host;
import org.eclipse.jgit.util.FileUtils;
@@ -72,7 +73,7 @@ public class OpenSshConfigTest extends RepositoryTestCase {
home = new File(trash, "home");
FileUtils.mkdir(home);
- configFile = new File(new File(home, ".ssh"), "config");
+ configFile = new File(new File(home, ".ssh"), Constants.CONFIG);
FileUtils.mkdir(configFile.getParentFile());
System.setProperty("user.name", "jex_junit");
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/BaseRepositoryBuilder.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/BaseRepositoryBuilder.java
index e4cecac..22a2ae5 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/BaseRepositoryBuilder.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/BaseRepositoryBuilder.java
@@ -623,7 +623,7 @@ public class BaseRepositoryBuilder<B extends BaseRepositoryBuilder, R extends Re
// the user file, as these parameters must be unique to this
// repository and not inherited from other files.
//
- File path = safeFS().resolve(getGitDir(), "config");
+ File path = safeFS().resolve(getGitDir(), Constants.CONFIG);
FileBasedConfig cfg = new FileBasedConfig(path, safeFS());
try {
cfg.load();
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java
index 6621e54..f6dff99 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java
@@ -322,6 +322,9 @@ public final class Constants {
/** Default name for the Git repository directory */
public static final String DOT_GIT = ".git";
+ /** Default name for the Git repository configuration */
+ public static final String CONFIG = "config";
+
/** A bare repository typically ends with this string */
public static final String DOT_GIT_EXT = ".git";
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileRepository.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileRepository.java
index 1377614..6cc5be5 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileRepository.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileRepository.java
@@ -160,8 +160,8 @@ public class FileRepository extends Repository {
systemConfig = SystemReader.getInstance().openSystemConfig(null, getFS());
userConfig = SystemReader.getInstance().openUserConfig(systemConfig,
getFS());
- repoConfig = new FileBasedConfig(userConfig, //
- getFS().resolve(getDirectory(), "config"), //
+ repoConfig = new FileBasedConfig(userConfig, getFS().resolve(
+ getDirectory(), Constants.CONFIG),
getFS());
loadSystemConfig();
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/OpenSshConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/OpenSshConfig.java
index 20f3174..a97c09b 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/OpenSshConfig.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/OpenSshConfig.java
@@ -60,6 +60,7 @@ import java.util.Map;
import org.eclipse.jgit.errors.InvalidPatternException;
import org.eclipse.jgit.fnmatch.FileNameMatcher;
+import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.util.FS;
import org.eclipse.jgit.util.StringUtils;
@@ -92,7 +93,7 @@ public class OpenSshConfig {
if (home == null)
home = new File(".").getAbsoluteFile();
- final File config = new File(new File(home, ".ssh"), "config");
+ final File config = new File(new File(home, ".ssh"), Constants.CONFIG);
final OpenSshConfig osc = new OpenSshConfig(home, config);
osc.refresh();
return osc;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkPushConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkPushConnection.java
index ce710b5..81aa4ab 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkPushConnection.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkPushConnection.java
@@ -365,7 +365,7 @@ class WalkPushConnection extends BaseConnection implements PushConnection {
final String config = "[core]\n"
+ "\trepositoryformatversion = 0\n";
final byte[] bytes = Constants.encode(config);
- dest.writeFile(ROOT_DIR + "config", bytes);
+ dest.writeFile(ROOT_DIR + Constants.CONFIG, bytes);
} catch (IOException e) {
throw new TransportException(uri, JGitText.get().cannotCreateConfig, e);
}