Bonobo.Git.Server.Test.Integration.ClAndWeb.MsysgitIntegrationTests.AnyCredentialHelperExists C# (CSharp) Метод

AnyCredentialHelperExists() приватный статический Метод

private static AnyCredentialHelperExists ( GitInstance git ) : bool
git GitInstance
Результат bool
        private static bool AnyCredentialHelperExists(GitInstance git)
        {
            IEnumerable<string> urls = new List<string>
            {
                string.Format(RepositoryUrlTemplate, string.Empty, string.Empty, string.Empty),
                string.Format(RepositoryUrlTemplate, AdminCredentials, string.Empty, string.Empty),
            };

            foreach (var url in urls)
            {
                var exists = RunGit(git, string.Format("config --get-urlmatch credential.helper {0}", url), WorkingDirectory);
                /* Credential.helper is a multi-valued configuration setting. This means it you cannot rely on the value returned by any of the calls
                 * as it might return an empty value, which is a valid(! altough pointless) value where there is a second configured value
                 * in the same config file. But you can rely on the exit code. 0 means it found this key. */
                /* There seems to be a bug in git config --get-urlmatch where it will retun 0 eventhough there was no match.
                 * So we need to check the value. The good part is that if it is not set anywhere we get an empty string. If
                 * it is set somewhere the string contains at least "\r\n".
                 * See the bug report here http://article.gmane.org/gmane.comp.version-control.git/287740 */
                if (exists.ExitCode == 0 && exists.StdOut != "")
                {
                    Console.Write(string.Format("Stdout: {0}", exists.StdOut));
                    Console.Write(string.Format("Stderr: {0}", exists.StdErr));
                    Debug.Write(string.Format("Stdout: {0}", exists.StdOut));
                    Debug.Write(string.Format("Stderr: {0}", exists.StdErr));
                    return true;
                }
            }

            return false;
        }