Exemplo n.º 1
0
        public override void InitializeView(IView parent)
        {
            base.InitializeView(parent);
            gitExecutableIsSet = Environment.GitExecutablePath.IsInitialized;

            var gitInstallDetails = new GitInstaller.GitInstallDetails(Environment.UserCachePath, Environment.IsWindows);

            portableGitPath = gitInstallDetails.GitExecutablePath;
        }
Exemplo n.º 2
0
 private void MaybeUpdateData()
 {
     if (refresh)
     {
         installationState = Environment.GitInstallationState;
         gitPath           = installationState.GitExecutablePath;
         gitLfsPath        = installationState.GitLfsExecutablePath;
         installDetails    = new GitInstaller.GitInstallDetails(Environment.UserCachePath, Environment.IsWindows);
         refresh           = false;
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Initialize environment after finding where git is. This needs to run on the main thread
        /// </summary>
        /// <param name="gitExecutablePath"></param>
        /// <param name="octorunScriptPath"></param>
        private void InitializeEnvironment(GitInstaller.GitInstallationState installationState)
        {
            isBusy = false;
            SetupMetrics();

            if (!installationState.GitIsValid)
            {
                return;
            }

            var gitInstallDetails = new GitInstaller.GitInstallDetails(Environment.UserCachePath, Environment.IsWindows);
            var isCustomGitExec   = installationState.GitExecutablePath != gitInstallDetails.GitExecutablePath;

            Environment.GitExecutablePath    = installationState.GitExecutablePath;
            Environment.GitLfsExecutablePath = installationState.GitLfsExecutablePath;

            Environment.IsCustomGitExecutable = isCustomGitExec;
            Environment.User.Initialize(GitClient);

            var afterGitSetup = new ActionTask(CancellationToken, RestartRepository)
                                .ThenInUI(InitializeUI);

            ITask task = afterGitSetup;

            if (Environment.IsWindows)
            {
                var credHelperTask = GitClient.GetConfig("credential.helper", GitConfigSource.Global);
                credHelperTask.OnEnd += (thisTask, credentialHelper, success, exception) =>
                {
                    if (!success || string.IsNullOrEmpty(credentialHelper))
                    {
                        Logger.Warning("No Windows CredentialHelper found: Setting to wincred");
                        thisTask
                        .Then(GitClient.SetConfig("credential.helper", "wincred", GitConfigSource.Global))
                        .Then(afterGitSetup);
                    }
                    else
                    {
                        thisTask.Then(afterGitSetup);
                    }
                };
                task = credHelperTask;
            }
            task.Start();
        }