GitSharp.CloneCommand.Execute C# (CSharp) Method

Execute() public method

public Execute ( ) : void
return void
        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);
        }

Usage Example

Exemplo n.º 1
0
 public static Repository Clone(CloneCommand command)
 {
     command.Execute();
     return(command.Repository);
 }
All Usage Examples Of GitSharp.CloneCommand::Execute