@Override public FileBasedConfig openUserConfig(Config parent, FS fs) { final File home = fs.userHome(); return new FileBasedConfig(parent, new File(home, ".gitconfig"), fs); //$NON-NLS-1$ }
@Override public FileBasedConfig openSystemConfig(Config parent, FS fs) { File configFile = fs.getGitSystemConfig(); if (configFile == null) { return new FileBasedConfig(null, fs) { @Override public void load() { // empty, do not load } @Override public boolean isOutdated() { // regular class would bomb here return false; } }; } return new FileBasedConfig(parent, configFile, fs); }
/** * Parse and load the repository specific configuration. * <p> * The default implementation reads {@code gitDir/config}, or returns an * empty configuration if gitDir was not set. * * @return the repository's configuration. * @throws java.io.IOException * the configuration is not available. */ protected Config loadConfig() throws IOException { if (getGitDir() != null) { // We only want the repository's configuration file, and not // the user file, as these parameters must be unique to this // repository and not inherited from other files. // File path = safeFS().resolve(getGitDir(), Constants.CONFIG); FileBasedConfig cfg = new FileBasedConfig(path, safeFS()); try { cfg.load(); } catch (ConfigInvalidException err) { throw new IllegalArgumentException(MessageFormat.format( JGitText.get().repositoryConfigFileInvalid, path .getAbsolutePath(), err.getMessage())); } return cfg; } else { return new Config(); } }
if (builder.getGitDir() != null) { workTree = builder.getWorkTree(); repoConfig = new FileBasedConfig(userConfig, new File(builder.getGitDir(), Constants.CONFIG), FS.DETECTED); repoAttributesFile = new File(builder.getGitDir(), Constants.INFO_ATTRIBUTES); } else { workTree = null; repoConfig = new FileBasedConfig(userConfig, null, FS.DETECTED) { @Override public void load() {
@Override public FileBasedConfig openUserConfig(Config parent, FS fs) { return new FileBasedConfig(parent, userConcigFile, fs); }
@Override public FileBasedConfig openUserConfig(Config parent, FS fs) { return new FileBasedConfig(parent, userConcigFile, fs); }
FileBasedConfig modulesConfig = new FileBasedConfig(new File( repo.getWorkTree(), Constants.DOT_GIT_MODULES), repo.getFS()); try {
getFS()); else systemConfig = new FileBasedConfig(null, FS.DETECTED) { @Override public void load() { userConfig = SystemReader.getInstance().openUserConfig(systemConfig, getFS()); repoConfig = new FileBasedConfig(userConfig, getFS().resolve( getDirectory(), Constants.CONFIG), getFS());
@Override public FileBasedConfig openSystemConfig(Config parent, FS fs) { File configFile = fs.getGitSystemConfig(); if (configFile == null) { return new FileBasedConfig(null, fs) { public void load() { // empty, do not load } public boolean isOutdated() { // regular class would bomb here return false; } }; } return new FileBasedConfig(parent, configFile, fs); }
@Override public FileBasedConfig openSystemConfig(Config parent, FS fs) { File configFile = fs.getGitSystemConfig(); if (configFile == null) { return new FileBasedConfig(null, fs) { public void load() { // empty, do not load } public boolean isOutdated() { // regular class would bomb here return false; } }; } return new FileBasedConfig(parent, configFile, fs); }
@Override public FileBasedConfig openUserConfig(Config parent, FS fs) { final File home = fs.userHome(); return new FileBasedConfig(parent, new File(home, ".gitconfig"), fs); //$NON-NLS-1$ }
public FileBasedConfig openUserConfig(Config parent, FS fs) { final File home = fs.userHome(); return new FileBasedConfig(parent, new File(home, ".gitconfig"), fs); //$NON-NLS-1$ }
File modulesFile = new File(repository.getWorkTree(), Constants.DOT_GIT_MODULES); FileBasedConfig config = new FileBasedConfig(modulesFile, repository.getFS()); config.load();
public FileBasedConfig openSystemConfig(Config parent, FS fs) { File configFile = fs.getGitSystemConfig(); if (configFile == null) { return new FileBasedConfig(null, fs) { public void load() { // empty, do not load } public boolean isOutdated() { // regular class would bomb here return false; } }; } return new FileBasedConfig(parent, configFile, fs); }
@Override public FileBasedConfig openSystemConfig(Config parent, FS fs) { File configFile = fs.getGitSystemConfig(); if (configFile == null) { return new FileBasedConfig(null, fs) { @Override public void load() { // empty, do not load } @Override public boolean isOutdated() { // regular class would bomb here return false; } }; } return new FileBasedConfig(parent, configFile, fs); }
@Override public Config get() { FileBasedConfig cfg = new FileBasedConfig(site.gerrit_config, FS.DETECTED); cfg = new FileBasedConfig(cfg, site.secure_config, FS.DETECTED); try { cfg.load();
@Before public void setUp() throws Exception { tmp = File.createTempFile("jgit_test_", "_tmp"); CleanupThread.deleteOnShutdown(tmp); if (!tmp.delete() || !tmp.mkdir()) throw new IOException("Cannot create " + tmp); mockSystemReader = new MockSystemReader(); mockSystemReader.userGitConfig = new FileBasedConfig(new File(tmp, "usergitconfig"), FS.DETECTED); ceilTestDirectories(getCeilings()); SystemReader.setInstance(mockSystemReader); final long now = mockSystemReader.getCurrentTime(); final int tz = mockSystemReader.getTimezone(now); author = new PersonIdent("J. Author", "jauthor@example.com"); author = new PersonIdent(author, now, tz); committer = new PersonIdent("J. Committer", "jcommitter@example.com"); committer = new PersonIdent(committer, now, tz); final WindowCacheConfig c = new WindowCacheConfig(); c.setPackedGitLimit(128 * WindowCacheConfig.KB); c.setPackedGitWindowSize(8 * WindowCacheConfig.KB); c.setPackedGitMMAP(useMMAP); c.setDeltaBaseCacheLimit(8 * WindowCacheConfig.KB); c.install(); }
@Before public void setUp() throws Exception { tmp = File.createTempFile("jgit_test_", "_tmp"); CleanupThread.deleteOnShutdown(tmp); if (!tmp.delete() || !tmp.mkdir()) throw new IOException("Cannot create " + tmp); mockSystemReader = new MockSystemReader(); mockSystemReader.userGitConfig = new FileBasedConfig(new File(tmp, "usergitconfig"), FS.DETECTED); ceilTestDirectories(getCeilings()); SystemReader.setInstance(mockSystemReader); final long now = mockSystemReader.getCurrentTime(); final int tz = mockSystemReader.getTimezone(now); author = new PersonIdent("J. Author", "jauthor@example.com"); author = new PersonIdent(author, now, tz); committer = new PersonIdent("J. Committer", "jcommitter@example.com"); committer = new PersonIdent(committer, now, tz); final WindowCacheConfig c = new WindowCacheConfig(); c.setPackedGitLimit(128 * WindowCacheConfig.KB); c.setPackedGitWindowSize(8 * WindowCacheConfig.KB); c.setPackedGitMMAP(useMMAP); c.setDeltaBaseCacheLimit(8 * WindowCacheConfig.KB); c.install(); }
protected Control createContents(Composite parent) { Composite displayArea = new Composite(parent, SWT.NONE); GridLayoutFactory.fillDefaults().applyTo(displayArea); GridDataFactory.fillDefaults().applyTo(displayArea); Repository repo = (Repository) getElement() .getAdapter(Repository.class); if (repo == null) return displayArea; StoredConfig config = repo.getConfig(); if (config instanceof FileBasedConfig) { File configFile = ((FileBasedConfig) config).getFile(); config = new FileBasedConfig(configFile, repo.getFS()); } editor = new ConfigurationEditorComponent(displayArea, config, true, false) { @Override protected void setErrorMessage(String message) { RepositoryPropertyPage.this.setErrorMessage(message); } }; editor.createContents(); return displayArea; }
private void list() throws IOException, ConfigInvalidException { final FS fs = getRepository().getFS(); if (configFile != null) { list(new FileBasedConfig(configFile, fs)); return; } if (system || (isListAll() && StringUtils.isEmptyOrNull(SystemReader .getInstance() .getenv(Constants.GIT_CONFIG_NOSYSTEM_KEY)))) list(SystemReader.getInstance().openSystemConfig(null, fs)); if (global || isListAll()) list(SystemReader.getInstance().openUserConfig(null, fs)); if (local || isListAll()) list(new FileBasedConfig(fs.resolve(getRepository().getDirectory(), Constants.CONFIG), fs)); }