Java 类org.eclipse.jgit.api.errors.InvalidRefNameException 实例源码

项目:commitmining-tools    文件:RepositoryFileWalker.java   
/**
 * Switch to the main branch and delete the temporary branch.
 *
 * @throws GitAPIException
 * @throws RefAlreadyExistsException
 * @throws RefNotFoundException
 * @throws InvalidRefNameException
 * @throws CheckoutConflictException
 * @throws NotMergedException
 * @throws CannotDeleteCurrentBranchException
 */
private void switchToMainAndDeleteFrom(final String tempBranch)
        throws GitAPIException, RefAlreadyExistsException,
        RefNotFoundException, InvalidRefNameException,
        CheckoutConflictException, NotMergedException,
        CannotDeleteCurrentBranchException {
    try {
        repository.reset().setMode(ResetType.HARD).call();
    } finally {
        try {
            repository.checkout().setCreateBranch(false)
            .setName(mainBranchName).setForce(true).call();
        } finally {
            try {
                repository.reset().setMode(ResetType.HARD).call();
            } finally {
                repository.branchDelete().setForce(true)
                .setBranchNames(tempBranch).call();
            }
        }
    }
}
项目:github-backup-java    文件:CreateOrphanBranchCommand.java   
@Override
public Ref call() throws GitAPIException, RefNotFoundException,
    CheckoutConflictException, InvalidRefNameException,
    RefAlreadyExistsException
{
    this.checkCallable();
    try {
        this.processOptions();
        this.checkoutStartPoint();
        RefUpdate update = this.getRepository().updateRef(Constants.HEAD);
        Result r = update.link(this.getBranchName());
        if (EnumSet.of(Result.NEW, Result.FORCED).contains(r) == false) {
            throw new JGitInternalException(MessageFormat.format(
                JGitText.get().checkoutUnexpectedResult, r.name()));
        }
        this.setCallable(false);
        return this.getRepository().getRef(Constants.HEAD);
    }
    catch (IOException e) {
        throw new JGitInternalException(e.getMessage(), e);
    }
}
项目:gradle-gitsemver    文件:TagBasedVersionFactoryTest.java   
private static Git initializeGitFlow(Repository repo)
        throws RefAlreadyExistsException, RefNotFoundException,
        InvalidRefNameException, GitAPIException {
    Git git = new Git(repo);
    git.commit().setCommitter(COMMITTER).setMessage("initial commit").call();
    return git;
}
项目:github-backup-java    文件:CreateOrphanBranchCommand.java   
protected void processOptions() throws InvalidRefNameException,
    RefAlreadyExistsException, IOException
{
    String branchName = this.getBranchName();
    if (this.name == null || Repository.isValidRefName(branchName) == false) {
        throw new InvalidRefNameException(MessageFormat.format(
            JGitText.get().branchNameInvalid, this.name == null ? "<null>"
                : this.name));
    }
    Ref refToCheck = this.getRepository().getRef(branchName);
    if (refToCheck != null) {
        throw new RefAlreadyExistsException(MessageFormat.format(
            JGitText.get().refAlreadyExists, this.name));
    }
}