GitCommands.GitCommands.CloneCmd C# (CSharp) Method

CloneCmd() public static method

public static CloneCmd ( string fromPath, string toPath, bool central, int depth ) : string
fromPath string
toPath string
central bool
depth int
return string
        public static string CloneCmd(string fromPath, string toPath, bool central, int? depth)
        {
            var from = FixPath(fromPath);
            var to = FixPath(toPath);
            var options = new List<string> { "-v" };
            if (central)
                options.Add("--bare");
            if (depth.HasValue)
                options.Add("--depth " + depth);
            if (VersionInUse.CloneCanAskForProgress)
                options.Add("--progress");
            options.Add(string.Format("\"{0}\"", from.Trim()));
            options.Add(string.Format("\"{0}\"", to.Trim()));

            return "clone " + string.Join(" ", options.ToArray());
        }
GitCommands