private String getOurCommitName() { // If onto is different from upstream, this should say "onto", but // RebaseCommand doesn't support a different "onto" at the moment. String ourCommitName = "Upstream, based on " //$NON-NLS-1$ + Repository.shortenRefName(upstreamCommitName); return ourCommitName; }
private String calculateOurName(Ref headRef) { if (ourCommitName != null) return ourCommitName; String targetRefName = headRef.getTarget().getName(); String headName = Repository.shortenRefName(targetRefName); return headName; }
private String calculateOurName(Ref headRef) { if (ourCommitName != null) return ourCommitName; String targetRefName = headRef.getTarget().getName(); String headName = Repository.shortenRefName(targetRefName); return headName; }
/** * Initialize a new rename operation. * * @param src * operation to read and delete the source. * @param dst * operation to create (or overwrite) the destination. */ protected RefRename(RefUpdate src, RefUpdate dst) { source = src; destination = dst; String cmd = ""; //$NON-NLS-1$ if (source.getName().startsWith(Constants.R_HEADS) && destination.getName().startsWith(Constants.R_HEADS)) cmd = "Branch: "; //$NON-NLS-1$ setRefLogMessage(cmd + "renamed " //$NON-NLS-1$ + Repository.shortenRefName(source.getName()) + " to " //$NON-NLS-1$ + Repository.shortenRefName(destination.getName())); }
/** * Get the short name of the current branch that {@code HEAD} points to. * <p> * This is essentially the same as {@link #getFullBranch()}, except the * leading prefix {@code refs/heads/} is removed from the reference before * it is returned to the caller. * * @return name of current branch (for example {@code master}), an ObjectId * in hex format if the current branch is detached, or {@code null} * if the repository is corrupt and has no HEAD reference. * @throws java.io.IOException */ @Nullable public String getBranch() throws IOException { String name = getFullBranch(); if (name != null) return shortenRefName(name); return null; }
private String getShortBranchName(Ref headRef) { if (headRef.isSymbolic()) { return Repository.shortenRefName(headRef.getTarget().getName()); } // Detached HEAD. Every non-symbolic ref in the ref database has an // object id, so this cannot be null. ObjectId id = headRef.getObjectId(); if (id == null) { throw new NullPointerException(); } return id.getName(); }
for (Ref ref : refsToMerge) { if (ref.getName().startsWith(Constants.R_HEADS)) { branches.add("'" + Repository.shortenRefName(ref.getName()) //$NON-NLS-1$ + "'"); //$NON-NLS-1$ } else if (ref.getName().startsWith(Constants.R_REMOTES)) { remoteBranches.add("'" //$NON-NLS-1$ + Repository.shortenRefName(ref.getName()) + "'"); //$NON-NLS-1$ } else if (ref.getName().startsWith(Constants.R_TAGS)) { tags.add("'" + Repository.shortenRefName(ref.getName()) + "'"); //$NON-NLS-1$ //$NON-NLS-2$ } else { ObjectId objectId = ref.getObjectId(); String targetShortName = Repository.shortenRefName(targetName); sb.append(" into " + targetShortName); //$NON-NLS-1$
remoteName = parent.getConfig().getString( ConfigConstants.CONFIG_BRANCH_SECTION, Repository.shortenRefName(ref.getName()), ConfigConstants.CONFIG_KEY_REMOTE);
/** * Get branch that HEAD currently points to * * @param subRepo * a {@link org.eclipse.jgit.lib.Repository} object. * @return shortened branch name, null on failures * @throws java.io.IOException */ protected String getHeadBranch(Repository subRepo) throws IOException { Ref head = subRepo.exactRef(Constants.HEAD); if (head != null && head.isSymbolic()) return Repository.shortenRefName(head.getLeaf().getName()); else return null; }
private void addMergeConfig(Repository clonedRepo, Ref head) throws IOException { String branchName = Repository.shortenRefName(head.getName()); clonedRepo.getConfig().setString(ConfigConstants.CONFIG_BRANCH_SECTION, branchName, ConfigConstants.CONFIG_KEY_REMOTE, remote); clonedRepo.getConfig().setString(ConfigConstants.CONFIG_BRANCH_SECTION, branchName, ConfigConstants.CONFIG_KEY_MERGE, head.getName()); String autosetupRebase = clonedRepo.getConfig().getString( ConfigConstants.CONFIG_BRANCH_SECTION, null, ConfigConstants.CONFIG_KEY_AUTOSETUPREBASE); if (ConfigConstants.CONFIG_KEY_ALWAYS.equals(autosetupRebase) || ConfigConstants.CONFIG_KEY_REMOTE.equals(autosetupRebase)) clonedRepo.getConfig().setEnum( ConfigConstants.CONFIG_BRANCH_SECTION, branchName, ConfigConstants.CONFIG_KEY_REBASE, BranchRebaseMode.REBASE); clonedRepo.getConfig().save(); }
private String getOurCommitName() { // If onto is different from upstream, this should say "onto", but // RebaseCommand doesn't support a different "onto" at the moment. String ourCommitName = "Upstream, based on " //$NON-NLS-1$ + Repository.shortenRefName(upstreamCommitName); return ourCommitName; }
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()); } } }
.getString( ConfigConstants.CONFIG_BRANCH_SECTION, Repository.shortenRefName(ref.getName()), ConfigConstants.CONFIG_KEY_MERGE); List<RefSpec> fetchRefSpecs = remoteConfig
if (ref != null && !ref.getName().startsWith(Constants.R_HEADS)) ref = null; String toName = Repository.shortenRefName(name); RefUpdate refUpdate = repo.updateRef(Constants.HEAD, ref == null); refUpdate.setForceUpdate(force);
/** * * @param ref * @return Shortened version of full ref path, suitable for display in UI */ public static String getCommitDisplayName(String ref) { if (getCommitType(ref) == COMMIT_TYPE_REMOTE) { return (ref != null && ref.length() > Constants.R_REFS.length()) ? ref.substring(Constants.R_REFS.length()) : ""; } return Repository.shortenRefName(ref); }
ru.setNewObjectId(commitId); String refName = Repository.shortenRefName(getRefOrHEAD()); if (isReflogDisabled) { ru.disableRefLog();
refUpdate.setRefLogMessage( "checkout: moving from " //$NON-NLS-1$ + Repository.shortenRefName(headName) + " to " + commit.getName(), false); //$NON-NLS-1$ Result res = refUpdate.forceUpdate();
Repository.shortenRefName(remoteBranchName), remoteUri);
return null; String branch = Repository.shortenRefName(head.getTarget() .getName());
throws IOException { String shortBranchName = Repository.shortenRefName(branchName); String fullBranchName = Constants.R_HEADS + shortBranchName; BranchConfig branchConfig = new BranchConfig(repository.getConfig(),