private void setSparseCheckout(File gitDir, Set<String> checkoutFiles) throws GitException { try (Git git = gitOpen()) { StoredConfig config = git.getRepository().getConfig(); config.setBoolean("core", null, "sparseCheckout", true); config.save();
private void updateSslVerify(StoredConfig config, boolean value) { // Since git uses the original URI for matching, we must also use the // original URI and cannot use the current URI (which might be different // after redirects). String uriPattern = uri.getScheme() + "://" + uri.getHost(); //$NON-NLS-1$ int port = uri.getPort(); if (port > 0) { uriPattern += ":" + port; //$NON-NLS-1$ } config.setBoolean(HttpConfig.HTTP, uriPattern, HttpConfig.SSL_VERIFY_KEY, value); try { config.save(); } catch (IOException e) { LOG.error(JGitText.get().sslVerifyCannotSave, e); } }
private void configureCreateChangeId() { config.setBoolean(ConfigConstants.CONFIG_GERRIT_SECTION, null, ConfigConstants.CONFIG_KEY_CREATECHANGEID, true); }
public static void setRefLogEnabled(boolean enabled, Repository repo) { StoredConfig config = repo.getConfig(); config.setBoolean(CONFIG_CORE_SECTION, null, CONFIG_KEY_LOGALLREFUPDATES, enabled); }
public static void setRefLogEnabled(boolean enabled, Repository repo) { StoredConfig config = repo.getConfig(); config.setBoolean(CONFIG_CORE_SECTION, null, CONFIG_KEY_LOGALLREFUPDATES, enabled); }
/** * To allow performing push operations from the cloned repository to remote (served by this server) let's * skip authorization for HTTP. */ private void enableInsecureReceiving(Repository repository) { final StoredConfig config = repository.getConfig(); config.setBoolean("http", null, "receivepack", true); try { config.save(); } catch (IOException e) { throw new RuntimeException("Unable to save http.receivepack=true config", e); } }
private void configRepo() throws IOException { StoredConfig config = repository.getConfig(); // Deal with line endings. A normalized repo has LF line endings. // OmegaT uses line endings of OS for storing tmx files. // To do auto converting, we need to change a setting: if ("\r\n".equals(System.lineSeparator())) { // on windows machines, convert text files to CRLF config.setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null, ConfigConstants.CONFIG_KEY_AUTOCRLF, true); } else { // on Linux/Mac machines (using LF), don't convert text files // but use input format, unchanged. // NB: I don't know correct setting for OS'es like MacOS <= 9, // which uses CR. Git manual only speaks about converting from/to // CRLF, so for CR, you probably don't want conversion either. config.setEnum(ConfigConstants.CONFIG_CORE_SECTION, null, ConfigConstants.CONFIG_KEY_AUTOCRLF, AutoCRLF.INPUT); } // Perform GC synchronously to avoid locking issues config.setBoolean(ConfigConstants.CONFIG_GC_SECTION, null, ConfigConstants.CONFIG_KEY_AUTODETACH, false); config.save(); }
private void setupSSLVerify(Repository repo) throws java.io.IOException { StoredConfig config = repo.getConfig(); config.setBoolean("http", null, "sslVerify", sslVerify); config.save(); }
private void updateSslVerify(StoredConfig config, boolean value) { // Since git uses the original URI for matching, we must also use the // original URI and cannot use the current URI (which might be different // after redirects). String uriPattern = uri.getScheme() + "://" + uri.getHost(); //$NON-NLS-1$ int port = uri.getPort(); if (port > 0) { uriPattern += ":" + port; //$NON-NLS-1$ } config.setBoolean(HttpConfig.HTTP, uriPattern, HttpConfig.SSL_VERIFY_KEY, value); try { config.save(); } catch (IOException e) { LOG.error(JGitText.get().sslVerifyCannotSave, e); } }
/** {@inheritDoc} */ @Override public Void call() throws Exception { StoredConfig cfg = null; if (repository == null) { cfg = loadUserConfig(); } else { cfg = repository.getConfig(); } cfg.setBoolean(ConfigConstants.CONFIG_FILTER_SECTION, ConfigConstants.CONFIG_SECTION_LFS, ConfigConstants.CONFIG_KEY_USEJGITBUILTIN, true); cfg.setBoolean(ConfigConstants.CONFIG_FILTER_SECTION, ConfigConstants.CONFIG_SECTION_LFS, ConfigConstants.CONFIG_KEY_REQUIRED, true); cfg.save(); // try to run git lfs install, we really don't care if it is present // and/or works here (yet). ProcessBuilder builder = FS.DETECTED.runInShell("git", //$NON-NLS-1$ repository == null ? ARGS_USER : ARGS_LOCAL); if (repository != null) { builder.directory(repository.isBare() ? repository.getDirectory() : repository.getWorkTree()); } FS.DETECTED.runProcess(builder, null, null, (String) null); return null; }
myConfig.setBoolean(ConfigConstants.CONFIG_BRANCH_SECTION, myBranchName, ConfigConstants.CONFIG_KEY_REBASE, true);
config.setBoolean(CONFIG_CORE_SECTION, null, CONFIG_KEY_SYMLINKS, false); config.setBoolean(CONFIG_CORE_SECTION, null, CONFIG_KEY_FILEMODE, false); config.setBoolean(CONFIG_DIFF_SECTION, null, CONFIG_KEY_RENAMES, false);
/** * @param gitBasedRepositoryConfiguration the configuration of the repository * @throws IOException thrown if repository does not exist * @throws GitAPIException thrown if there was an error while checking the status of the repository * @throws NoWorkTreeException thrown if the directory is not a git work tree */ public GitBasedRepository(GitBasedRepositoryConfiguration gitBasedRepositoryConfiguration) throws IOException, NoWorkTreeException, GitAPIException { super(Objects.requireNonNull(gitBasedRepositoryConfiguration)); this.gitBasedRepositoryConfiguration = gitBasedRepositoryConfiguration; FileRepositoryBuilder builder = new FileRepositoryBuilder(); Repository gitRepo = builder.setWorkTree(this.repositoryRoot.toFile()).setMustExist(false).build(); if (!Files.exists(this.repositoryRoot.resolve(".git"))) { gitRepo.create(); } // explicitly enable longpaths to ensure proper handling of long pathss gitRepo.getConfig().setBoolean("core", null, "longpaths", true); gitRepo.getConfig().save(); this.eventBus = new EventBus(); this.git = new Git(gitRepo); if (gitBasedRepositoryConfiguration.isAutoCommit() && !this.git.status().call().isClean()) { this.addCommit("Files changed externally."); } }
config.setBoolean(CONFIG_CORE_SECTION, null, CONFIG_KEY_SYMLINKS, false); config.setBoolean(CONFIG_CORE_SECTION, null, CONFIG_KEY_FILEMODE, false); config.setBoolean(CONFIG_DIFF_SECTION, null, CONFIG_KEY_RENAMES, false);
config.setBoolean(CONFIG_CORE_SECTION, null, CONFIG_KEY_SYMLINKS, false); config.setBoolean(CONFIG_CORE_SECTION, null, CONFIG_KEY_FILEMODE, false); config.setBoolean(CONFIG_DIFF_SECTION, null, CONFIG_KEY_RENAMES, false);
dst.create(); final StoredConfig dstcfg = dst.getConfig(); dstcfg.setBoolean("core", null, "bare", false); //$NON-NLS-1$ //$NON-NLS-2$ dstcfg.save(); db = dst;
@Override public void fixCygwinIfNeeded(JGitFlow flow) throws JGitFlowReleaseException { if(isCygwin) { getLogger().info("detected cygwin:"); try { getLogger().info(" - turning off filemode..."); StoredConfig config = flow.git().getRepository().getConfig(); config.setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null, ConfigConstants.CONFIG_KEY_FILEMODE, false); config.save(); config.load(); } catch (IOException e) { throw new JGitFlowReleaseException("error configuring filemode for cygwin", e); } catch (ConfigInvalidException e) { throw new JGitFlowReleaseException("error configuring filemode for cygwin", e); } getLogger().info(" - fixing maven prompter..."); prompter.setCygwinTerminal(); } }