package com.atlassian.bitbucket.mesh.git.exception;

import com.atlassian.bitbucket.mesh.rpc.v1.RpcEmptyRebase;
import com.atlassian.bitbucket.mesh.rpc.v1.RpcGitError;

import javax.annotation.Nonnull;

public class EmptyRebaseException extends RebaseException {

    public EmptyRebaseException() {
        super("The target branch includes identical changes; rebase discarded all incoming commits");
    }

    @Nonnull
    @Override
    public RpcGitError toError() {
        return RpcGitError.newBuilder()
                .setEmptyRebase(RpcEmptyRebase.getDefaultInstance())
                .build();
    }
}
