Browse Source

Add constant for default name for the Git repo configuration

Change-Id: I5a6ef686c444fb1e46c9f784bad01165471ef372
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
stable-1.3
Tomasz Zarna 13 years ago committed by Matthias Sohn
parent
commit
5d95cd9418
  1. 2
      org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/RepositorySetupWorkDirTest.java
  2. 4
      org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/T0003_BasicTest.java
  3. 3
      org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/OpenSshConfigTest.java
  4. 2
      org.eclipse.jgit/src/org/eclipse/jgit/lib/BaseRepositoryBuilder.java
  5. 3
      org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java
  6. 4
      org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileRepository.java
  7. 3
      org.eclipse.jgit/src/org/eclipse/jgit/transport/OpenSshConfig.java
  8. 2
      org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkPushConnection.java

2
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, private FileBasedConfig configFor(File gitDir) throws IOException,
ConfigInvalidException { ConfigInvalidException {
File configPath = new File(gitDir, "config"); File configPath = new File(gitDir, Constants.CONFIG);
FileBasedConfig cfg = new FileBasedConfig(configPath, FS.DETECTED); FileBasedConfig cfg = new FileBasedConfig(configPath, FS.DETECTED);
cfg.load(); cfg.load();
return cfg; return cfg;

4
org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/T0003_BasicTest.java

@ -326,7 +326,7 @@ public class T0003_BasicTest extends SampleDataRepositoryTestCase {
@Test @Test
public void test006_ReadUglyConfig() throws IOException, public void test006_ReadUglyConfig() throws IOException,
ConfigInvalidException { 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 FileBasedConfig c = new FileBasedConfig(cfg, db.getFS());
final String configStr = " [core];comment\n\tfilemode = yes\n" final String configStr = " [core];comment\n\tfilemode = yes\n"
+ "[user]\n" + "[user]\n"
@ -361,7 +361,7 @@ public class T0003_BasicTest extends SampleDataRepositoryTestCase {
@Test @Test
public void test008_FailOnWrongVersion() throws IOException { 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 badvers = "ihopethisisneveraversion";
final String configStr = "[core]\n" + "\trepositoryFormatVersion=" final String configStr = "[core]\n" + "\trepositoryFormatVersion="
+ badvers + "\n"; + badvers + "\n";

3
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.IOException;
import java.io.OutputStreamWriter; import java.io.OutputStreamWriter;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.RepositoryTestCase; import org.eclipse.jgit.lib.RepositoryTestCase;
import org.eclipse.jgit.transport.OpenSshConfig.Host; import org.eclipse.jgit.transport.OpenSshConfig.Host;
import org.eclipse.jgit.util.FileUtils; import org.eclipse.jgit.util.FileUtils;
@ -72,7 +73,7 @@ public class OpenSshConfigTest extends RepositoryTestCase {
home = new File(trash, "home"); home = new File(trash, "home");
FileUtils.mkdir(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()); FileUtils.mkdir(configFile.getParentFile());
System.setProperty("user.name", "jex_junit"); System.setProperty("user.name", "jex_junit");

2
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 // the user file, as these parameters must be unique to this
// repository and not inherited from other files. // 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()); FileBasedConfig cfg = new FileBasedConfig(path, safeFS());
try { try {
cfg.load(); cfg.load();

3
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 */ /** Default name for the Git repository directory */
public static final String DOT_GIT = ".git"; 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 */ /** A bare repository typically ends with this string */
public static final String DOT_GIT_EXT = ".git"; public static final String DOT_GIT_EXT = ".git";

4
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()); systemConfig = SystemReader.getInstance().openSystemConfig(null, getFS());
userConfig = SystemReader.getInstance().openUserConfig(systemConfig, userConfig = SystemReader.getInstance().openUserConfig(systemConfig,
getFS()); getFS());
repoConfig = new FileBasedConfig(userConfig, // repoConfig = new FileBasedConfig(userConfig, getFS().resolve(
getFS().resolve(getDirectory(), "config"), // getDirectory(), Constants.CONFIG),
getFS()); getFS());
loadSystemConfig(); loadSystemConfig();

3
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.errors.InvalidPatternException;
import org.eclipse.jgit.fnmatch.FileNameMatcher; import org.eclipse.jgit.fnmatch.FileNameMatcher;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.util.FS; import org.eclipse.jgit.util.FS;
import org.eclipse.jgit.util.StringUtils; import org.eclipse.jgit.util.StringUtils;
@ -92,7 +93,7 @@ public class OpenSshConfig {
if (home == null) if (home == null)
home = new File(".").getAbsoluteFile(); 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); final OpenSshConfig osc = new OpenSshConfig(home, config);
osc.refresh(); osc.refresh();
return osc; return osc;

2
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" final String config = "[core]\n"
+ "\trepositoryformatversion = 0\n"; + "\trepositoryformatversion = 0\n";
final byte[] bytes = Constants.encode(config); final byte[] bytes = Constants.encode(config);
dest.writeFile(ROOT_DIR + "config", bytes); dest.writeFile(ROOT_DIR + Constants.CONFIG, bytes);
} catch (IOException e) { } catch (IOException e) {
throw new TransportException(uri, JGitText.get().cannotCreateConfig, e); throw new TransportException(uri, JGitText.get().cannotCreateConfig, e);
} }

Loading…
Cancel
Save