private static void EnsureReposAreCleanAndUpToDate(IEnumerable <string> solutionPaths, string branch) { foreach (string solutionPath in solutionPaths) { Console.WriteLine($"Checking status of {solutionPath}."); if (GitUtility.IsGitRepo(solutionPath)) { string currentBranch = GitUtility.GetCurrentBranch(solutionPath); RepoStatus repoStatus = GitUtility.GetRepoStatus(solutionPath); if (currentBranch != branch) { throw new ExpectationFailedException($"{solutionPath} is checked out to {currentBranch}, expected {branch}."); } if (repoStatus != RepoStatus.CleanAndUpToDate) { throw new ExpectationFailedException($"{solutionPath} is not clean and up to date: {repoStatus.ToStatusString()}."); } } else { throw new ExpectationFailedException($"{solutionPath} is not a git repo."); } } Console.WriteLine(); }