Skip to content

Commit

Permalink
Cosmetic tweaks to improve error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
gitfool authored and arturcic committed May 22, 2020
1 parent 8921bf6 commit d7889a4
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/GitVersionCore.Tests/Core/GitVersionExecutorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ public void WorkingDirectoryWithoutGit()
var gitVersionCalculator = GetGitVersionCalculator(gitVersionOptions);
gitVersionCalculator.CalculateVersionVariables();
});
exception.Message.ShouldContain("Can't find the .git directory in");
exception.Message.ShouldContain("Cannot find the .git directory");
}

[Test]
Expand Down
4 changes: 2 additions & 2 deletions src/GitVersionCore/Extensions/GitVersionOptionsExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static string GetDotGitDirectory(this GitVersionOptions gitVersionOptions

dotGitDirectory = dotGitDirectory?.TrimEnd('/', '\\');
if (string.IsNullOrEmpty(dotGitDirectory))
throw new DirectoryNotFoundException($"Can't find the .git directory in {dotGitDirectory}");
throw new DirectoryNotFoundException("Cannot find the .git directory");

return dotGitDirectory.Contains(Path.Combine(".git", "worktrees"))
? Directory.GetParent(Directory.GetParent(dotGitDirectory).FullName).FullName
Expand All @@ -32,7 +32,7 @@ public static string GetProjectRootDirectory(this GitVersionOptions gitVersionOp
var dotGitDirectory = Repository.Discover(gitVersionOptions.WorkingDirectory);

if (string.IsNullOrEmpty(dotGitDirectory))
throw new DirectoryNotFoundException($"Can't find the .git directory in {dotGitDirectory}");
throw new DirectoryNotFoundException("Cannot find the .git directory");

using var repository = new Repository(dotGitDirectory);
return repository.Info.WorkingDirectory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public override IEnumerable<BaseVersion> GetVersions()
}
catch (NotFoundException exception)
{
throw new GitVersionException($"Can't find commit {currentBranchTip.Sha}. Please ensure that the repository is an unshallow clone with `git fetch --unshallow`.", exception);
throw new GitVersionException($"Cannot find commit {currentBranchTip.Sha}. Please ensure that the repository is an unshallow clone with `git fetch --unshallow`.", exception);
}

yield return new BaseVersion("Fallback base version", false, new SemanticVersion(minor: 1), baseVersionSource, null);
Expand Down
2 changes: 1 addition & 1 deletion src/GitVersionExe.Tests/ExecCmdLineArgumentTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public void WorkingDirectoryWithoutGitFolderFailsWithInformativeMessage()
var result = GitVersionHelper.ExecuteIn(Environment.SystemDirectory, arguments: null, logToFile: false);

result.ExitCode.ShouldNotBe(0);
result.Output.ShouldContain("Can't find the .git directory in");
result.Output.ShouldContain("Cannot find the .git directory");
}

[Test]
Expand Down

0 comments on commit d7889a4

Please sign in to comment.