public void SetupGit(GitInstaller.GitInstallationState state)
        {
            if (!state.GitIsValid || !state.GitLfsIsValid)
            {
                if (!state.GitExecutablePath.IsInitialized)
                {
                    Logger.Warning(Localization.GitNotFound);
                }
                else if (!state.GitLfsExecutablePath.IsInitialized)
                {
                    Logger.Warning(Localization.GitLFSNotFound);
                }
                else if (state.GitVersion < Constants.MinimumGitVersion)
                {
                    Logger.Warning(String.Format(Localization.GitVersionTooLow, state.GitExecutablePath, state.GitVersion, Constants.MinimumGitVersion));
                }
                else if (state.GitLfsVersion < Constants.MinimumGitLfsVersion)
                {
                    Logger.Warning(String.Format(Localization.GitLfsVersionTooLow, state.GitLfsExecutablePath, state.GitLfsVersion, Constants.MinimumGitLfsVersion));
                }
                return;
            }

            Environment.GitInstallationState = state;
            Environment.User.Initialize(GitClient);

            if (firstRun)
            {
                if (Environment.RepositoryPath.IsInitialized)
                {
                    UpdateMergeSettings();

                    GitClient.LfsInstall()
                    .Catch(e =>
                    {
                        Logger.Error(e, "Error running lfs install");
                        return(true);
                    })
                    .RunSynchronously();
                }

                if (Environment.IsWindows)
                {
                    var credentialHelper = GitClient.GetConfig("credential.helper", GitConfigSource.Global)
                                           .Catch(e =>
                    {
                        Logger.Error(e, "Error getting the credential helper");
                        return(true);
                    }).RunSynchronously();

                    if (string.IsNullOrEmpty(credentialHelper))
                    {
                        Logger.Warning("No Windows CredentialHelper found: Setting to wincred");
                        GitClient.SetConfig("credential.helper", "wincred", GitConfigSource.Global)
                        .Catch(e =>
                        {
                            Logger.Error(e, "Error setting the credential helper");
                            return(true);
                        })
                        .RunSynchronously();
                    }
                }
            }
        }
Exemple #2
0
        public ITask DeleteBranch(string branch, bool deleteUnmerged = false)
        {
            var task = GitClient.DeleteBranch(branch, deleteUnmerged);

            return(HookupHandlers(task, false));
        }
Exemple #3
0
        public ITask CreateBranch(string branch, string baseBranch)
        {
            var task = GitClient.CreateBranch(branch, baseBranch);

            return(HookupHandlers(task, false));
        }
Exemple #4
0
        public ITask SwitchBranch(string branch)
        {
            var task = GitClient.SwitchBranch(branch);

            return(HookupHandlers(task, true));
        }
Exemple #5
0
        public ITask RemoteChange(string remote, string url)
        {
            var task = GitClient.RemoteChange(remote, url);

            return(HookupHandlers(task, true));
        }
Exemple #6
0
        public ITask RemoteRemove(string remote)
        {
            var task = GitClient.RemoteRemove(remote);

            return(HookupHandlers(task, true));
        }
Exemple #7
0
        public ITask Revert(string changeset)
        {
            var task = GitClient.Revert(changeset);

            return(HookupHandlers(task, true));
        }
Exemple #8
0
        public ITask Pull(string remote, string branch)
        {
            var task = GitClient.Pull(remote, branch);

            return(HookupHandlers(task, true));
        }