From cbdb01f6951d7aa7e60856061126547d3c9048c1 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Mon, 17 Mar 2025 15:09:07 +0100 Subject: [PATCH 1/2] Fix git information lookup folder, fixes incremental compilation. --- src/Elastic.Markdown/BuildContext.cs | 2 +- .../IO/Discovery/GitCheckoutInformation.cs | 10 ++-------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/Elastic.Markdown/BuildContext.cs b/src/Elastic.Markdown/BuildContext.cs index 38b26aa06..7ab413c81 100644 --- a/src/Elastic.Markdown/BuildContext.cs +++ b/src/Elastic.Markdown/BuildContext.cs @@ -76,7 +76,7 @@ public BuildContext(DiagnosticsCollector collector, IFileSystem readFileSystem, if (ConfigurationPath.FullName != DocumentationSourceDirectory.FullName) DocumentationSourceDirectory = ConfigurationPath.Directory!; - Git = GitCheckoutInformation.Create(DocumentationSourceDirectory, ReadFileSystem); + Git = GitCheckoutInformation.Create(rootFolder, ReadFileSystem); Configuration = new ConfigurationFile(ConfigurationPath, DocumentationSourceDirectory, this); } diff --git a/src/Elastic.Markdown/IO/Discovery/GitCheckoutInformation.cs b/src/Elastic.Markdown/IO/Discovery/GitCheckoutInformation.cs index f32c2fd2e..0d6996a57 100644 --- a/src/Elastic.Markdown/IO/Discovery/GitCheckoutInformation.cs +++ b/src/Elastic.Markdown/IO/Discovery/GitCheckoutInformation.cs @@ -11,8 +11,6 @@ namespace Elastic.Markdown.IO.Discovery; public record GitCheckoutInformation { - private string? _repositoryName; - private static GitCheckoutInformation Unavailable { get; } = new() { Branch = "unavailable", @@ -30,12 +28,8 @@ public record GitCheckoutInformation [JsonPropertyName("ref")] public required string Ref { get; init; } - [JsonIgnore] - public string? RepositoryName - { - get => _repositoryName ??= Remote.Split('/').Last(); - init => _repositoryName = value; - } + [JsonPropertyName("name")] + public string? RepositoryName { get; init; } // manual read because libgit2sharp is not yet AOT ready public static GitCheckoutInformation Create(IDirectoryInfo source, IFileSystem fileSystem, ILogger? logger = null) From 5a6d6bb6389c7b17b867bde6c9fe5dfeb6a7bc79 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Mon, 17 Mar 2025 16:29:50 +0100 Subject: [PATCH 2/2] fix test not including origin.name --- tests/authoring/Generator/LinkReferenceFile.fs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/authoring/Generator/LinkReferenceFile.fs b/tests/authoring/Generator/LinkReferenceFile.fs index 38e530d82..68f1433a4 100644 --- a/tests/authoring/Generator/LinkReferenceFile.fs +++ b/tests/authoring/Generator/LinkReferenceFile.fs @@ -58,7 +58,8 @@ Through various means $$$including-this-inline-syntax$$$ "origin": { "branch": "test-e35fcb27-5f60-4e", "remote": "elastic/docs-builder", - "ref": "e35fcb27-5f60-4e" + "ref": "e35fcb27-5f60-4e", + "name": "docs-builder" }, "url_path_prefix": "", "links": {