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

import com.atlassian.bitbucket.mesh.git.builder.GitProcess;
import com.atlassian.bitbucket.mesh.git.builder.commit.GitCommitBuilder;

import javax.annotation.Nonnull;

/**
 * An interim builder to allow callers to choose between a {@link #normal() normal} {@code git merge} and a
 * {@link #squash() squashing} merge. Each option returns a builder with methods tailored to include only
 * those options which are appropriate for the type of merge being performed.
 */
public interface GitMerge {

    /**
     * Creates a builder which can be used to create a {@link GitProcess process} for running {@code git merge}.
     * Whether or not a merge commit is created will depend on the configuration of the created command, and on
     * the commits being merged.
     *
     * @return a new builder for creating a merge command
     */
    @Nonnull
    GitMergeBuilder normal();

    /**
     * Creates a builder which can be used to create a {@link GitProcess process} for running {@code git merge
     * --squash}, which will not produce a merge commit and, instead, will merge incoming changes into the work
     * tree and then exit.
     * <p>
     * When using {@code git merge --squash}, the {@link GitCommitBuilder commit}
     * must be performed explicitly. Prior to committing the changes, arbitrary additional work can be done, as well
     * as directly controlling the commit details.
     *
     * @return a new builder for creating a squashing merge command
     */
    @Nonnull
    GitSquashMergeBuilder squash();
}
