Skip to content

Commit d7889a4

Browse files
gitfoolarturcic
authored andcommitted
Cosmetic tweaks to improve error messages
1 parent 8921bf6 commit d7889a4

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

src/GitVersionCore.Tests/Core/GitVersionExecutorTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ public void WorkingDirectoryWithoutGit()
391391
var gitVersionCalculator = GetGitVersionCalculator(gitVersionOptions);
392392
gitVersionCalculator.CalculateVersionVariables();
393393
});
394-
exception.Message.ShouldContain("Can't find the .git directory in");
394+
exception.Message.ShouldContain("Cannot find the .git directory");
395395
}
396396

397397
[Test]

src/GitVersionCore/Extensions/GitVersionOptionsExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public static string GetDotGitDirectory(this GitVersionOptions gitVersionOptions
1515

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

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

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

3737
using var repository = new Repository(dotGitDirectory);
3838
return repository.Info.WorkingDirectory;

src/GitVersionCore/VersionCalculation/BaseVersionCalculators/FallbackVersionStrategy.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public override IEnumerable<BaseVersion> GetVersions()
3333
}
3434
catch (NotFoundException exception)
3535
{
36-
throw new GitVersionException($"Can't find commit {currentBranchTip.Sha}. Please ensure that the repository is an unshallow clone with `git fetch --unshallow`.", exception);
36+
throw new GitVersionException($"Cannot find commit {currentBranchTip.Sha}. Please ensure that the repository is an unshallow clone with `git fetch --unshallow`.", exception);
3737
}
3838

3939
yield return new BaseVersion("Fallback base version", false, new SemanticVersion(minor: 1), baseVersionSource, null);

src/GitVersionExe.Tests/ExecCmdLineArgumentTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public void WorkingDirectoryWithoutGitFolderFailsWithInformativeMessage()
7777
var result = GitVersionHelper.ExecuteIn(Environment.SystemDirectory, arguments: null, logToFile: false);
7878

7979
result.ExitCode.ShouldNotBe(0);
80-
result.Output.ShouldContain("Can't find the .git directory in");
80+
result.Output.ShouldContain("Cannot find the .git directory");
8181
}
8282

8383
[Test]

0 commit comments

Comments
 (0)