diff --git a/src/Elastic.Markdown/BuildContext.cs b/src/Elastic.Markdown/BuildContext.cs index 7edcb02a8..bd232b8c2 100644 --- a/src/Elastic.Markdown/BuildContext.cs +++ b/src/Elastic.Markdown/BuildContext.cs @@ -76,9 +76,9 @@ public BuildContext(DiagnosticsCollector collector, IFileSystem readFileSystem, if (ConfigurationPath.FullName != DocumentationSourceDirectory.FullName) DocumentationSourceDirectory = ConfigurationPath.Directory!; + Git = GitCheckoutInformation.Create(DocumentationSourceDirectory, ReadFileSystem); Configuration = new ConfigurationFile(this); - } private (IDirectoryInfo, IFileInfo) FindDocsFolderFromRoot(IDirectoryInfo rootPath) 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) 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": {