Skip to content

Commit 3cb0b39

Browse files
authored
Fix git information lookup folder, fixes incremental compilation. (#756)
* Fix git information lookup folder, fixes incremental compilation. * fix test not including origin.name
1 parent 756b45c commit 3cb0b39

File tree

3 files changed

+5
-10
lines changed

3 files changed

+5
-10
lines changed

src/Elastic.Markdown/BuildContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ public BuildContext(DiagnosticsCollector collector, IFileSystem readFileSystem,
7676
if (ConfigurationPath.FullName != DocumentationSourceDirectory.FullName)
7777
DocumentationSourceDirectory = ConfigurationPath.Directory!;
7878

79+
7980
Git = GitCheckoutInformation.Create(DocumentationSourceDirectory, ReadFileSystem);
8081
Configuration = new ConfigurationFile(this);
81-
8282
}
8383

8484
private (IDirectoryInfo, IFileInfo) FindDocsFolderFromRoot(IDirectoryInfo rootPath)

src/Elastic.Markdown/IO/Discovery/GitCheckoutInformation.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ namespace Elastic.Markdown.IO.Discovery;
1111

1212
public record GitCheckoutInformation
1313
{
14-
private string? _repositoryName;
15-
1614
private static GitCheckoutInformation Unavailable { get; } = new()
1715
{
1816
Branch = "unavailable",
@@ -30,12 +28,8 @@ public record GitCheckoutInformation
3028
[JsonPropertyName("ref")]
3129
public required string Ref { get; init; }
3230

33-
[JsonIgnore]
34-
public string? RepositoryName
35-
{
36-
get => _repositoryName ??= Remote.Split('/').Last();
37-
init => _repositoryName = value;
38-
}
31+
[JsonPropertyName("name")]
32+
public string? RepositoryName { get; init; }
3933

4034
// manual read because libgit2sharp is not yet AOT ready
4135
public static GitCheckoutInformation Create(IDirectoryInfo source, IFileSystem fileSystem, ILogger? logger = null)

tests/authoring/Generator/LinkReferenceFile.fs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ Through various means $$$including-this-inline-syntax$$$
5858
"origin": {
5959
"branch": "test-e35fcb27-5f60-4e",
6060
"remote": "elastic/docs-builder",
61-
"ref": "e35fcb27-5f60-4e"
61+
"ref": "e35fcb27-5f60-4e",
62+
"name": "docs-builder"
6263
},
6364
"url_path_prefix": "",
6465
"links": {

0 commit comments

Comments
 (0)