TeamMentor.CoreLib.GitExe.CloneUsingGitExe C# (CSharp) Method

CloneUsingGitExe() public static method

public static CloneUsingGitExe ( string gitLocation, string targetFolder ) : bool
gitLocation string
targetFolder string
return bool
        public static bool CloneUsingGitExe(string gitLocation, string targetFolder)
        {
            if ("git.exe".startProcess_getConsoleOut().valid())     // we found Git
            {
                "[GitUtil] Using Git.Exe for the clone".info();
                var parameters = "clone \"{0}\" \"{1}\"".format(gitLocation.remove("\""), targetFolder.remove("\""));
                var cloneLog   = "git.exe".startProcess_getConsoleOut(parameters);
                "[GitUtil {0}".info(cloneLog);
                if (targetFolder.isGitRepository())
                    return true;
                "[GitUtil Target folder was not a Git REPO".error(targetFolder);
            }
            "[GitUtil] could not find git.exe on the current server".info();
            return false;
        }

Usage Example

Example #1
0
        public static TM_UserData_Git   clone_UserDataRepo(this TM_UserData_Git userData, string gitLocation, string targetFolder)
        {
            var start = DateTime.Now;

            "[TM_UserData] [GitClone] Start".info();
            if (GitExe.CloneUsingGitExe(gitLocation, targetFolder).isFalse())
            {
                "[TM_UserData] [GitClone] Using NGit for the clone".info();
                gitLocation.git_Clone(targetFolder);
            }
            "\n\n[TM_UserData] [GitClone] in  {0}\n\n".debug(start.duration_To_Now());
            return(userData);
        }
All Usage Examples Of TeamMentor.CoreLib.GitExe::CloneUsingGitExe