From 7b38bf5d735623922ab608020ac12dceb5677b7d Mon Sep 17 00:00:00 2001 From: Kouji Matsui Date: Fri, 23 Jun 2023 14:22:22 +0900 Subject: [PATCH 1/4] Fixed causing NRE on uninitialized git repository. --- CenterCLR.RelaxVersioner.Core/Processor.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/CenterCLR.RelaxVersioner.Core/Processor.cs b/CenterCLR.RelaxVersioner.Core/Processor.cs index 8105cf0..1001b9c 100644 --- a/CenterCLR.RelaxVersioner.Core/Processor.cs +++ b/CenterCLR.RelaxVersioner.Core/Processor.cs @@ -89,7 +89,8 @@ private static async Task WriteVersionSourceFileAsync( await targetBranch.GetHeadCommitAsync(ct) : null; - var commitId = commit?.Hash.ToString() ?? string.Empty; + var commitId = commit?.Hash.ToString() ?? + "unknown"; static string FormatSignature(Signature? sig) => sig is { } s ? (s.MailAddress is { } ma ? $"{s.Name} <{ma}>" : s.Name) : @@ -168,13 +169,13 @@ static string FormatSignature(Signature? sig) => sig is { } s ? intDateVersion, epochIntDateVersion, commitId, - targetBranch.Name, + targetBranch?.Name, tags, commitDate, author, committer, - commit.Subject, - commit.Body); + commit?.Subject, + commit?.Body); } public async Task RunAsync( @@ -200,7 +201,7 @@ public async Task RunAsync( logger, writer, context, - repository.Head, + repository?.Head, DateTimeOffset.Now, ruleSet, importSet, From 11aa10c52b06dff69bd25bfd97af3ea5f53fdb3c Mon Sep 17 00:00:00 2001 From: Kouji Matsui Date: Fri, 23 Jun 2023 14:22:31 +0900 Subject: [PATCH 2/4] Updated GitReader. --- .../CenterCLR.RelaxVersioner.Core.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CenterCLR.RelaxVersioner.Core/CenterCLR.RelaxVersioner.Core.csproj b/CenterCLR.RelaxVersioner.Core/CenterCLR.RelaxVersioner.Core.csproj index 411b5ea..50fdaaf 100644 --- a/CenterCLR.RelaxVersioner.Core/CenterCLR.RelaxVersioner.Core.csproj +++ b/CenterCLR.RelaxVersioner.Core/CenterCLR.RelaxVersioner.Core.csproj @@ -12,7 +12,7 @@ - + From b232ed095e5762409eb4ba9a0060298b66b82774 Mon Sep 17 00:00:00 2001 From: Kouji Matsui Date: Fri, 23 Jun 2023 14:23:49 +0900 Subject: [PATCH 3/4] Updated self-hosted package. --- .../CenterCLR.RelaxVersioner.Core.csproj | 2 +- .../CenterCLR.RelaxVersioner.Tasks.csproj | 2 +- CenterCLR.RelaxVersioner/CenterCLR.RelaxVersioner.csproj | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CenterCLR.RelaxVersioner.Core/CenterCLR.RelaxVersioner.Core.csproj b/CenterCLR.RelaxVersioner.Core/CenterCLR.RelaxVersioner.Core.csproj index 50fdaaf..13ee40d 100644 --- a/CenterCLR.RelaxVersioner.Core/CenterCLR.RelaxVersioner.Core.csproj +++ b/CenterCLR.RelaxVersioner.Core/CenterCLR.RelaxVersioner.Core.csproj @@ -15,7 +15,7 @@ - + diff --git a/CenterCLR.RelaxVersioner.Tasks/CenterCLR.RelaxVersioner.Tasks.csproj b/CenterCLR.RelaxVersioner.Tasks/CenterCLR.RelaxVersioner.Tasks.csproj index d106f13..7e61ea6 100644 --- a/CenterCLR.RelaxVersioner.Tasks/CenterCLR.RelaxVersioner.Tasks.csproj +++ b/CenterCLR.RelaxVersioner.Tasks/CenterCLR.RelaxVersioner.Tasks.csproj @@ -27,7 +27,7 @@ - + diff --git a/CenterCLR.RelaxVersioner/CenterCLR.RelaxVersioner.csproj b/CenterCLR.RelaxVersioner/CenterCLR.RelaxVersioner.csproj index afc3b57..1c1fed5 100644 --- a/CenterCLR.RelaxVersioner/CenterCLR.RelaxVersioner.csproj +++ b/CenterCLR.RelaxVersioner/CenterCLR.RelaxVersioner.csproj @@ -28,7 +28,7 @@ - + From 065e2f8beb53f90b88ad7f854c0b8241e34fc94d Mon Sep 17 00:00:00 2001 From: Kouji Matsui Date: Fri, 23 Jun 2023 14:26:21 +0900 Subject: [PATCH 4/4] Updated readme. --- README.ja.md | 2 ++ README.md | 2 ++ 2 files changed, 4 insertions(+) diff --git a/README.ja.md b/README.ja.md index 3c5bec3..7d0c325 100644 --- a/README.ja.md +++ b/README.ja.md @@ -454,6 +454,8 @@ nuspecファイルを使ってパッケージを生成する場合は、デフ ## 履歴 +* 2.16.0: + * 初期化されていない Git リポジトリで NRE が発生する問題を修正。 * 2.15.0: * Gitリポジトリの読み取りを、libgit2sharp から [GitReader](https://github.com/kekyo/GitReader) に変更しました。 ネイティブライブラリに依存しなくなったため、動作環境の制限が緩和されます。 diff --git a/README.md b/README.md index f15ee56..2a7337b 100644 --- a/README.md +++ b/README.md @@ -435,6 +435,8 @@ When you are using a nuspec file to generate a NuGet package, there are addition ## History +* 2.16.0: + * Fixed causing NRE on uninitialized git repository. * 2.15.0: * Changed reading of Git repositories using [GitReader](https://github.com/kekyo/GitReader) instead of libgit2sharp. The native library no longer depends on it, which eases the limitation of the operating environment.