public override void Execute()
{
if (Source.Length <= 0)
{
throw new ArgumentNullException("Repository", "fatal: You must specify a repository to clone.");
}
URIish source = new URIish(Source);
if (Mirror)
{
Bare = true;
}
if (Bare)
{
if (OriginName != null)
{
throw new ArgumentException("Bare+Origin", "--bare and --origin " + OriginName + " options are incompatible.");
}
NoCheckout = true;
}
if (OriginName == null)
{
OriginName = "origin";
}
var repo = new GitSharp.Core.Repository(new DirectoryInfo(ActualDirectory));
repo.Create(Bare);
repo.Config.setBoolean("core", null, "bare", Bare);
repo.Config.save();
Repository = new Repository(repo);
if (!Quiet)
{
OutputStream.WriteLine("Initialized empty Git repository in " + repo.Directory.FullName);
OutputStream.Flush();
}
saveRemote(source);
FetchResult r = runFetch();
GitSharp.Core.Ref branch = guessHEAD(r);
if (!NoCheckout)
{
doCheckout(branch);
}
}