private async Task <CmdResult2> CmdAsync(
            string gitArgs, GitOptions options, CancellationToken ct)
        {
            CmdResult2 result;
            bool       isRetry  = false;
            string     username = null;

            do
            {
                using (CredentialSession session = new CredentialSession(credentialService, username))
                {
                    result = await RunGitCmsAsync(gitArgs, options, session.SessionId, ct);

                    username = session.Username;
                    session.ConfirmValidCrededntial(!IsAuthenticationFailed(result));
                    isRetry = IsAuthenticationFailed(result) &&
                              session.IsCredentialRequested &&
                              !session.IsAskPassCanceled;

                    if (isRetry)
                    {
                        UiThread.Run(() => message.ShowError($"Invalid credentials for {session.TargetUri}"));
                    }
                }
            } while (isRetry);


            return(result);
        }
Exemple #2
0
        private bool TryGet(
            string url,
            string username,
            string targetKey,
            string message,
            bool isNameReadonly,
            out IGitCredential gitCredential)
        {
            CredentialsDialog dialog = null;

            UiThread.Run(() => dialog = ShowDialog(targetKey, username, message, isNameReadonly));

            if (dialog != null)
            {
                gitCredential = new GitCredential(dialog, url);
                return(true);
            }

            Log.Debug("Credentials dialog canceled");
            gitCredential = null;
            return(false);
        }