package com.atlassian.bitbucket.mesh.git.builder.merge;

import com.atlassian.bitbucket.mesh.git.builder.GitProcessBuilder;

import javax.annotation.Nonnull;

public class DefaultGitMergeBase implements GitMergeBase {

    private final GitProcessBuilder builder;

    public DefaultGitMergeBase(GitProcessBuilder builder) {
        this.builder = builder.command("merge-base");
    }

    @Nonnull
    @Override
    public GitMergeBaseBuilder between(@Nonnull String firstCommit, @Nonnull String secondCommit) {
        return new DefaultGitMergeBaseBuilder(builder).commits(firstCommit, secondCommit);
    }

    @Nonnull
    @Override
    public GitMergeBaseBuilder octopus() {
        return new DefaultGitMergeBaseBuilder(builder, "--octopus");
    }

    @Nonnull
    @Override
    public GitMergeBaseIndependentBuilder independent() {
        return new DefaultGitMergeBaseIndependentBuilder(builder);
    }
}
