예제 #1
0
        protected override Task <bool> RunInternalAsync(StringBuilder log, IList <string> additionalFiles)
        {
            log.Append("Getting Git version...");
            GitVersion gitVersion = _git.Version;

            log.AppendLine(" OK");
            log.AppendLine($"Git version is '{gitVersion.OriginalString}'");

            log.Append("Locating current repository...");
            string thisRepo = _git.GetCurrentRepository();

            log.AppendLine(" OK");
            log.AppendLine(thisRepo is null ? "Not inside a Git repository." : $"Git repository at '{thisRepo}'");

            log.Append("Listing all Git configuration...");
            Process configProc = _git.CreateProcess("config --list --show-origin");

            configProc.Start();
            configProc.WaitForExit();
            string gitConfig = configProc.StandardOutput.ReadToEnd().TrimEnd();

            log.AppendLine(" OK");
            log.AppendLine("Git configuration:");
            log.AppendLine(gitConfig);
            log.AppendLine();

            return(Task.FromResult(true));
        }
예제 #2
0
 /// <summary>
 /// Returns true if the current Git instance is scoped to a local repository.
 /// </summary>
 /// <param name="git">Git object.</param>
 /// <returns>True if inside a local Git repository, false otherwise.</returns>
 public static bool IsInsideRepository(this IGit git)
 {
     return(!string.IsNullOrWhiteSpace(git.GetCurrentRepository()));
 }