This is a clean repro:
#:package LibGit2Sharp@0.*
#:package Spectre.Console@0.*
using System;
using LibGit2Sharp;
using Spectre.Console;
using var repo = new Repository(Environment.CurrentDirectory);
var signature = repo.Config.BuildSignature(DateTimeOffset.Now);
if (signature == null)
{
AnsiConsole.MarkupLine("[red] Unexpected error: Git user.name and/or user.email are not configured.[/]");
return 1;
}
else
{
AnsiConsole.MarkupLine($"[lime]{signature}[/]");
return 0;
}
When running this script from a git repo dir with dotnet run --file repro.cs, you get the proper signature built from the found config.
Doing dotnet publish repro.cs and then running it from artifacts\repro\repro.exe will result in the error path consistently.
The PR #2188 fixes it and can be verified by changing the above repro script to use my CI feed:
#:package LibGit2Sharp@0.31.1
#:package Spectre.Console@0.*
#:property RestoreSources=https://api.nuget.org/v3/index.json;https://pkg.kzu.app/index.json
This is a clean repro:
When running this script from a git repo dir with
dotnet run --file repro.cs, you get the proper signature built from the found config.Doing
dotnet publish repro.csand then running it fromartifacts\repro\repro.exewill result in the error path consistently.The PR #2188 fixes it and can be verified by changing the above repro script to use my CI feed: