using LibGit2Sharp.Core;
using LibGit2Sharp.Handlers;
namespace LibGit2Sharp
{
///
/// Options to define clone behaviour
///
public sealed class CloneOptions : FetchOptionsBase, IConvertableToGitCheckoutOpts
{
///
/// Creates default for a non-bare clone
///
public CloneOptions()
{
Checkout = true;
}
///
/// True will result in a bare clone, false a full clone.
///
public bool IsBare { get; set; }
///
/// If true, the origin's HEAD will be checked out. This only applies
/// to non-bare repositories.
///
public bool Checkout { get; set; }
///
/// The name of the branch to checkout. When unspecified the
/// remote's default branch will be used instead.
///
public string BranchName { get; set; }
///
/// Recursively clone submodules.
///
public bool RecurseSubmodules { get; set; }
///
/// Handler for checkout progress information.
///
public CheckoutProgressHandler OnCheckoutProgress { get; set; }
#region IConvertableToGitCheckoutOpts
CheckoutCallbacks IConvertableToGitCheckoutOpts.GenerateCallbacks()
{
return CheckoutCallbacks.From(OnCheckoutProgress, null);
}
CheckoutStrategy IConvertableToGitCheckoutOpts.CheckoutStrategy
{
get
{
return this.Checkout
? CheckoutStrategy.GIT_CHECKOUT_SAFE
: CheckoutStrategy.GIT_CHECKOUT_NONE;
}
}
CheckoutNotifyFlags IConvertableToGitCheckoutOpts.CheckoutNotifyFlags
{
get { return CheckoutNotifyFlags.None; }
}
#endregion
}
}