Skip to content

Fix git information lookup folder, fixes incremental compilation. #756

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Elastic.Markdown/BuildContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 2 additions & 8 deletions src/Elastic.Markdown/IO/Discovery/GitCheckoutInformation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ namespace Elastic.Markdown.IO.Discovery;

public record GitCheckoutInformation
{
private string? _repositoryName;

private static GitCheckoutInformation Unavailable { get; } = new()
{
Branch = "unavailable",
Expand All @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion tests/authoring/Generator/LinkReferenceFile.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down