/** {@inheritDoc} */ @SuppressWarnings("nls") @Override public String toString() { return getClass().getSimpleName() + "[" + getFile().getPath() + "]"; }
/** * Whether the currently loaded configuration file is outdated * * @return returns true if the currently loaded configuration file is older * than the file on disk */ public boolean isOutdated() { return snapshot.isModified(getFile()); }
private void loadSystemConfig() throws IOException { try { systemConfig.load(); } catch (ConfigInvalidException e) { throw new IOException(MessageFormat.format(JGitText .get().systemConfigFileInvalid, systemConfig.getFile() .getAbsolutePath(), e), e); } }
private void loadUserConfig() throws IOException { try { userConfig.load(); } catch (ConfigInvalidException e) { throw new IOException(MessageFormat.format(JGitText .get().userConfigFileInvalid, userConfig.getFile() .getAbsolutePath(), e), e); } }
private void updateSslVerifyUser(boolean value) { FileBasedConfig userConfig = SystemReader.getInstance() .openUserConfig(null, FS.DETECTED); try { userConfig.load(); updateSslVerify(userConfig, value); } catch (IOException | ConfigInvalidException e) { // Log it, but otherwise ignore here. LOG.error(MessageFormat.format(JGitText.get().userConfigFileInvalid, userConfig.getFile().getAbsolutePath(), e)); } }
/** * Creates a {@link org.eclipse.jgit.transport.HttpConfig} that reads values * solely from the user config. * * @param uri * to get the configuration values for */ public HttpConfig(URIish uri) { FileBasedConfig userConfig = SystemReader.getInstance() .openUserConfig(null, FS.DETECTED); try { userConfig.load(); } catch (IOException | ConfigInvalidException e) { // Log it and then work with default values. LOG.error(MessageFormat.format(JGitText.get().userConfigFileInvalid, userConfig.getFile().getAbsolutePath(), e)); init(new Config(), uri); return; } init(userConfig, uri); }
while (true) { final FileSnapshot oldSnapshot = snapshot; final FileSnapshot newSnapshot = FileSnapshot.save(getFile()); try { final byte[] in = IO.readFully(getFile()); final ObjectId newHash = hash(in); if (hash.equals(newHash)) { .format(JGitText.get().cannotReadFile, getFile()), e); } catch (ConfigInvalidException e) { throw new ConfigInvalidException(MessageFormat .format(JGitText.get().cannotReadFile, getFile()), e);
public void create(boolean bare) throws IOException { final FileBasedConfig cfg = getConfig(); if (cfg.getFile().exists()) { throw new IllegalStateException(MessageFormat.format( JGitText.get().repositoryAlreadyExists, getDirectory()));
@SuppressWarnings("nls") @Override public String toString() { return getClass().getSimpleName() + "[" + getFile().getPath() + "]"; }
/** {@inheritDoc} */ @SuppressWarnings("nls") @Override public String toString() { return getClass().getSimpleName() + "[" + getFile().getPath() + "]"; }
/** * Whether the currently loaded configuration file is outdated * * @return returns true if the currently loaded configuration file is older * than the file on disk */ public boolean isOutdated() { return snapshot.isModified(getFile()); }
/** * @return returns true if the currently loaded configuration file is older * than the file on disk */ public boolean isOutdated() { return snapshot.isModified(getFile()); } }
private void loadUserConfig() throws IOException { try { userConfig.load(); } catch (ConfigInvalidException e1) { IOException e2 = new IOException(MessageFormat.format(JGitText .get().userConfigFileInvalid, userConfig.getFile() .getAbsolutePath(), e1)); e2.initCause(e1); throw e2; } }
private void loadSystemConfig() throws IOException { try { systemConfig.load(); } catch (ConfigInvalidException e) { throw new IOException(MessageFormat.format(JGitText .get().systemConfigFileInvalid, systemConfig.getFile() .getAbsolutePath(), e), e); } }
private void loadUserConfig() throws IOException { try { userConfig.load(); } catch (ConfigInvalidException e) { throw new IOException(MessageFormat.format(JGitText .get().userConfigFileInvalid, userConfig.getFile() .getAbsolutePath(), e), e); } }
private void updateSslVerifyUser(boolean value) { FileBasedConfig userConfig = SystemReader.getInstance() .openUserConfig(null, FS.DETECTED); try { userConfig.load(); updateSslVerify(userConfig, value); } catch (IOException | ConfigInvalidException e) { // Log it, but otherwise ignore here. LOG.error(MessageFormat.format(JGitText.get().userConfigFileInvalid, userConfig.getFile().getAbsolutePath(), e)); } }
private static boolean exist(File repoDir) { try { final RepositoryBuilder repositoryBuilder = new RepositoryBuilder().setGitDir(repoDir); final org.eclipse.jgit.lib.Repository repository = repositoryBuilder.build(); if (repository.getConfig() instanceof FileBasedConfig) { return ((FileBasedConfig) repository.getConfig()).getFile().exists(); } return repository.getDirectory().exists(); } catch (IOException e) { throw new StorageException("failed to check if repository exists at " + repoDir, e); } }
private static boolean exist(File repoDir) { try { final RepositoryBuilder repositoryBuilder = new RepositoryBuilder().setGitDir(repoDir); final org.eclipse.jgit.lib.Repository repository = repositoryBuilder.build(); if (repository.getConfig() instanceof FileBasedConfig) { return ((FileBasedConfig) repository.getConfig()).getFile().exists(); } return repository.getDirectory().exists(); } catch (IOException e) { throw new StorageException("failed to check if repository exists at " + repoDir, e); } }