/** * Whether to remove refs which no longer exist in the source * * @return whether to remove refs which no longer exist in the source */ public boolean isRemoveDeletedRefs() { if (removeDeletedRefs != null) return removeDeletedRefs.booleanValue(); else { // fall back to configuration boolean result = false; StoredConfig config = repo.getConfig(); result = config.getBoolean(ConfigConstants.CONFIG_FETCH_SECTION, null, ConfigConstants.CONFIG_KEY_PRUNE, result); result = config.getBoolean(ConfigConstants.CONFIG_REMOTE_SECTION, remote, ConfigConstants.CONFIG_KEY_PRUNE, result); return result; } }
private List<String> getV2CapabilityAdvertisement() { ArrayList<String> caps = new ArrayList<>(); caps.add("version 2"); //$NON-NLS-1$ caps.add(COMMAND_LS_REFS); boolean advertiseRefInWant = transferConfig.isAllowRefInWant() && db.getConfig().getBoolean("uploadpack", null, //$NON-NLS-1$ "advertiserefinwant", true); //$NON-NLS-1$ caps.add( COMMAND_FETCH + '=' + (transferConfig.isAllowFilter() ? OPTION_FILTER + ' ' : "") + //$NON-NLS-1$ (advertiseRefInWant ? CAPABILITY_REF_IN_WANT + ' ' : "") + //$NON-NLS-1$ OPTION_SHALLOW); caps.add(CAPABILITY_SERVER_OPTION); return caps; }
PackedRefList getPackedRefs() throws IOException { boolean trustFolderStat = getRepository().getConfig().getBoolean( ConfigConstants.CONFIG_CORE_SECTION, ConfigConstants.CONFIG_KEY_TRUSTFOLDERSTAT, true); final PackedRefList curList = packedRefs.get(); if (trustFolderStat && !curList.snapshot.isModified(packedRefsFile)) { return curList; } final PackedRefList newList = readPackedRefs(); if (packedRefs.compareAndSet(curList, newList) && !curList.id.equals(newList.id)) { modCnt.incrementAndGet(); } return newList; }
private void autoGc() { Repository repo = getRepository(); if (!repo.getConfig().getBoolean(ConfigConstants.CONFIG_RECEIVE_SECTION, ConfigConstants.CONFIG_KEY_AUTOGC, true)) { return; } repo.autoGC(NullProgressMonitor.INSTANCE); }
private static void runBuiltinFilterCommand(Repository repo, CheckoutMetadata checkoutMetadata, ObjectLoader ol, OutputStream channel) throws MissingObjectException, IOException { boolean isMandatory = repo.getConfig().getBoolean( ConfigConstants.CONFIG_FILTER_SECTION, ConfigConstants.CONFIG_SECTION_LFS, ConfigConstants.CONFIG_KEY_REQUIRED, false); FilterCommand command = null; try { command = FilterCommandRegistry.createFilterCommand( checkoutMetadata.smudgeFilterCommand, repo, ol.openStream(), channel); } catch (IOException e) { LOG.error(JGitText.get().failedToDetermineFilterDefinition, e); if (!isMandatory) { // In case an IOException occurred during creating of the // command then proceed as if there would not have been a // builtin filter (only if the filter is not mandatory). ol.copyTo(channel); } else { throw e; } } if (command != null) { while (command.run() != -1) { // loop as long as command.run() tells there is work to do } } }
private void autoStash() throws GitAPIException, IOException { if (repo.getConfig().getBoolean(ConfigConstants.CONFIG_REBASE_SECTION, ConfigConstants.CONFIG_KEY_AUTOSTASH, false)) { String message = MessageFormat.format( AUTOSTASH_MSG, Repository .shortenRefName(getHeadName(getHead()))); RevCommit stashCommit = Git.wrap(repo).stashCreate().setRef(null) .setWorkingDirectoryMessage( message) .call(); if (stashCommit != null) { FileUtils.mkdir(rebaseState.getDir()); rebaseState.createFile(AUTOSTASH, stashCommit.getName()); } } }
/** * @return whether or not to remove refs which no longer exist in the source */ public boolean isRemoveDeletedRefs() { if (removeDeletedRefs != null) return removeDeletedRefs.booleanValue(); else { // fall back to configuration boolean result = false; StoredConfig config = repo.getConfig(); result = config.getBoolean(ConfigConstants.CONFIG_FETCH_SECTION, null, ConfigConstants.CONFIG_KEY_PRUNE, result); result = config.getBoolean(ConfigConstants.CONFIG_REMOTE_SECTION, remote, ConfigConstants.CONFIG_KEY_PRUNE, result); return result; } }
public static boolean isRefLogEnabled(Repository repo) { StoredConfig config = repo.getConfig(); return config.getBoolean(CONFIG_CORE_SECTION, null, CONFIG_KEY_LOGALLREFUPDATES, false); }
/** * Whether to remove refs which no longer exist in the source * * @return whether to remove refs which no longer exist in the source */ public boolean isRemoveDeletedRefs() { if (removeDeletedRefs != null) return removeDeletedRefs.booleanValue(); else { // fall back to configuration boolean result = false; StoredConfig config = repo.getConfig(); result = config.getBoolean(ConfigConstants.CONFIG_FETCH_SECTION, null, ConfigConstants.CONFIG_KEY_PRUNE, result); result = config.getBoolean(ConfigConstants.CONFIG_REMOTE_SECTION, remote, ConfigConstants.CONFIG_KEY_PRUNE, result); return result; } }
public static boolean isRefLogEnabled(Repository repo) { StoredConfig config = repo.getConfig(); return config.getBoolean(CONFIG_CORE_SECTION, null, CONFIG_KEY_LOGALLREFUPDATES, false); }
/** * @param db * the repository * @return whether LFS is requested for the given repo. */ @Override public boolean isEnabled(Repository db) { if (db == null) { return false; } return db.getConfig().getBoolean(ConfigConstants.CONFIG_FILTER_SECTION, ConfigConstants.CONFIG_SECTION_LFS, ConfigConstants.CONFIG_KEY_USEJGITBUILTIN, false); }
private List<String> getV2CapabilityAdvertisement() { ArrayList<String> caps = new ArrayList<>(); caps.add("version 2"); //$NON-NLS-1$ caps.add(COMMAND_LS_REFS); boolean advertiseRefInWant = transferConfig.isAllowRefInWant() && db.getConfig().getBoolean("uploadpack", null, //$NON-NLS-1$ "advertiserefinwant", true); //$NON-NLS-1$ caps.add( COMMAND_FETCH + '=' + (transferConfig.isAllowFilter() ? OPTION_FILTER + ' ' : "") + //$NON-NLS-1$ (advertiseRefInWant ? CAPABILITY_REF_IN_WANT + ' ' : "") + //$NON-NLS-1$ OPTION_SHALLOW); caps.add(CAPABILITY_SERVER_OPTION); return caps; }
CommitIdDatabase(Repository repo) { // NB: We enable fsync only when our Git repository has been configured so, // because there's no point of doing fsync only on this file when the // Git repository does not. this(repo.getDirectory(), repo.getConfig().getBoolean(CONFIG_CORE_SECTION, "fsyncObjectFiles", false)); }
CommitIdDatabase(Repository repo) { // NB: We enable fsync only when our Git repository has been configured so, // because there's no point of doing fsync only on this file when the // Git repository does not. this(repo.getDirectory(), repo.getConfig().getBoolean(CONFIG_CORE_SECTION, "fsyncObjectFiles", false)); }
CommitIdDatabase(Repository repo) { // NB: We enable fsync only when our Git repository has been configured so, // because there's no point of doing fsync only on this file when the // Git repository does not. this(repo.getDirectory(), repo.getConfig().getBoolean(CONFIG_CORE_SECTION, "fsyncObjectFiles", false)); }
private void autoGc() { Repository repo = getRepository(); if (!repo.getConfig().getBoolean(ConfigConstants.CONFIG_RECEIVE_SECTION, ConfigConstants.CONFIG_KEY_AUTOGC, true)) { return; } repo.autoGC(NullProgressMonitor.INSTANCE); }
PackedRefList getPackedRefs() throws IOException { boolean trustFolderStat = getRepository().getConfig().getBoolean( ConfigConstants.CONFIG_CORE_SECTION, ConfigConstants.CONFIG_KEY_TRUSTFOLDERSTAT, true); final PackedRefList curList = packedRefs.get(); if (trustFolderStat && !curList.snapshot.isModified(packedRefsFile)) { return curList; } final PackedRefList newList = readPackedRefs(); if (packedRefs.compareAndSet(curList, newList) && !curList.id.equals(newList.id)) { modCnt.incrementAndGet(); } return newList; }
/** * Sets the defaults for change id and signed off */ public void setDefaults() { if (repository != null) createChangeId = repository.getConfig().getBoolean( ConfigConstants.CONFIG_GERRIT_SECTION, ConfigConstants.CONFIG_KEY_CREATECHANGEID, false); signedOff = org.eclipse.egit.ui.Activator.getDefault() .getPreferenceStore() .getBoolean(UIPreferences.COMMIT_DIALOG_SIGNED_OFF_BY); }
private void autoStash() throws GitAPIException, IOException { if (repo.getConfig().getBoolean(ConfigConstants.CONFIG_REBASE_SECTION, ConfigConstants.CONFIG_KEY_AUTOSTASH, false)) { String message = MessageFormat.format( AUTOSTASH_MSG, Repository .shortenRefName(getHeadName(getHead()))); RevCommit stashCommit = Git.wrap(repo).stashCreate().setRef(null) .setWorkingDirectoryMessage( message) .call(); if (stashCommit != null) { FileUtils.mkdir(rebaseState.getDir()); rebaseState.createFile(AUTOSTASH, stashCommit.getName()); } } }
private void autoStash() throws GitAPIException, IOException { if (repo.getConfig().getBoolean(ConfigConstants.CONFIG_REBASE_SECTION, ConfigConstants.CONFIG_KEY_AUTOSTASH, false)) { String message = MessageFormat.format( AUTOSTASH_MSG, Repository .shortenRefName(getHeadName(getHead()))); RevCommit stashCommit = Git.wrap(repo).stashCreate().setRef(null) .setWorkingDirectoryMessage( message) .call(); if (stashCommit != null) { FileUtils.mkdir(rebaseState.getDir()); rebaseState.createFile(AUTOSTASH, stashCommit.getName()); } } }