@NotNull @Override public Map<String, String> getCheckoutProperties(@NotNull VcsRoot root) throws VcsException { Map<String, String> defaults = getDefaultVcsProperties(); Set<String> significantProps = setOf( Constants.FETCH_URL, Constants.SUBMODULES_CHECKOUT, Constants.AGENT_CLEAN_POLICY, Constants.AGENT_CLEAN_FILES_POLICY); Map<String, String> rootProperties = root.getProperties(); Map<String, String> repositoryProperties = new HashMap<String, String>(); for (String key : significantProps) { String defVal = defaults.get(key); String actualVal = rootProperties.get(key); repositoryProperties.put(key, actualVal == null ? defVal : actualVal); } // include autocrlf settings only for non-default value // in order to avoid clean checkout if ("true".equals(rootProperties.get(Constants.SERVER_SIDE_AUTO_CRLF))) repositoryProperties.put( Constants.SERVER_SIDE_AUTO_CRLF, rootProperties.get(Constants.SERVER_SIDE_AUTO_CRLF)); return repositoryProperties; }
@NotNull public RepositoryStateData getCurrentState(@NotNull GitVcsRoot gitRoot) throws VcsException { String refInRoot = gitRoot.getRef(); String fullRef = GitUtils.expandRef(refInRoot); Map<String, String> branchRevisions = new HashMap<String, String>(); for (Ref ref : getRemoteRefs(gitRoot.getOriginalRoot()).values()) { if (!ref.getName().startsWith("ref")) continue; if (!gitRoot.isReportTags() && isTag(ref) && !fullRef.equals(ref.getName())) continue; branchRevisions.put(ref.getName(), getRevision(ref)); } if (branchRevisions.get(fullRef) == null && !gitRoot.isIgnoreMissingDefaultBranch()) { throw new VcsException( "Cannot find revision of the default branch '" + refInRoot + "' of vcs root " + LogUtil.describe(gitRoot)); } return RepositoryStateData.createVersionState(fullRef, branchRevisions); }