Skip to content

Commit 1e9f2fd

Browse files
dependabot[bot]arturcic
authored andcommitted
(deps): Bump LibGit2Sharp from 0.30.0 to 0.31.0 in /src
Bumps [LibGit2Sharp](https://github.com/libgit2/libgit2sharp) from 0.30.0 to 0.31.0. - [Release notes](https://github.com/libgit2/libgit2sharp/releases) - [Changelog](https://github.com/libgit2/libgit2sharp/blob/master/CHANGES.md) - [Commits](libgit2/libgit2sharp@0.30.0...0.31.0) --- updated-dependencies: - dependency-name: LibGit2Sharp dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]>
1 parent 6f024d2 commit 1e9f2fd

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

src/Directory.Packages.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
</PropertyGroup>
55
<ItemGroup>
66
<!-- common packages -->
7-
<PackageVersion Include="LibGit2Sharp" Version="0.30.0" />
7+
<PackageVersion Include="LibGit2Sharp" Version="0.31.0" />
88
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0" />
99
<PackageVersion Include="Microsoft.CodeAnalysis.Common" Version="4.11.0" />
1010
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.11.0" />

src/GitVersion.App.Tests/ExecCmdLineArgumentTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public void WorkingDirectoryWithoutGitFolderFailsWithInformativeMessage()
5656

5757
result.ExitCode.ShouldNotBe(0);
5858
result.Output.ShouldNotBeNull();
59-
result.Output.ShouldContain("Cannot find the .git directory");
59+
result.Output.ShouldContain("failed to resolve path");
6060
}
6161

6262
[TestCase(" -help")]

src/GitVersion.LibGit2Sharp/Git/GitRepositoryInfo.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,9 @@ public GitRepositoryInfo(IOptions<GitVersionOptions> options)
6666
: Repository.Discover(gitVersionOptions.WorkingDirectory);
6767

6868
gitDirectory = gitDirectory?.TrimEnd('/', '\\');
69-
if (gitDirectory.IsNullOrEmpty())
70-
throw new DirectoryNotFoundException("Cannot find the .git directory");
69+
EnsureGitDirectory(gitDirectory);
7170

72-
var directoryInfo = Directory.GetParent(gitDirectory) ?? throw new DirectoryNotFoundException("Cannot find the .git directory");
71+
var directoryInfo = Directory.GetParent(gitDirectory) ?? throw new DirectoryNotFoundException();
7372
return gitDirectory.Contains(PathHelper.Combine(".git", "worktrees"))
7473
? Directory.GetParent(directoryInfo.FullName)?.FullName
7574
: gitDirectory;
@@ -84,8 +83,7 @@ private string GetProjectRootDirectory()
8483

8584
var gitDirectory = Repository.Discover(gitVersionOptions.WorkingDirectory);
8685

87-
if (gitDirectory.IsNullOrEmpty())
88-
throw new DirectoryNotFoundException("Cannot find the .git directory");
86+
EnsureGitDirectory(gitDirectory);
8987

9088
return new Repository(gitDirectory).Info.WorkingDirectory;
9189
}
@@ -110,4 +108,10 @@ private static bool GitRepoHasMatchingRemote(string possiblePath, string targetU
110108
return false;
111109
}
112110
}
111+
112+
private static void EnsureGitDirectory(string? gitDirectory)
113+
{
114+
if (gitDirectory.IsNullOrWhiteSpace())
115+
throw new DirectoryNotFoundException("Cannot find the .git directory");
116+
}
113117
}

0 commit comments

Comments
 (0)