Skip to content

Commit

Permalink
fix - fix install hook exception and update test SDK version +semver:…
Browse files Browse the repository at this point in the history
… minor (#129)
  • Loading branch information
guibranco authored Nov 20, 2024
1 parent 2f179bd commit 91b9809
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions Src/AiCommitMessage/Services/InstallHookService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ public static void InstallHook(InstallHookOptions options)
if (string.IsNullOrWhiteSpace(options.Path))
{
directory = Path.Combine(GetGitRepositoryRootLevel(), GetHooksDirectory());
EnsureDirectoryExists(directory);
}

var hookPath = Path.Combine(directory, "prepare-commit-msg");
Expand Down Expand Up @@ -190,7 +189,7 @@ private static void ExtractEmbeddedResource(
string file
)
{
EnsureDirectoryExists(outputDir);
EnsureDirectoryExists(Path.Combine(outputDir, file));
using var stream = typeof(InstallHookService).Assembly.GetManifestResourceStream(
resourceLocation + "." + file
);
Expand Down Expand Up @@ -219,7 +218,7 @@ string file
private static void EnsureDirectoryExists(string path)
{
var directoryName = Path.GetDirectoryName(path);
if (directoryName is { Length: > 0 })
if (directoryName is { Length: > 0 } && !Directory.Exists(directoryName))
{
Directory.CreateDirectory(directoryName);
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/AiCommitMessage.Tests/AiCommitMessage.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="FluentAssertions" Version="6.12.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="NSubstitute" Version="5.3.0" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
Expand Down

0 comments on commit 91b9809

Please sign in to comment.