diff --git a/src/GitVersion.Core.Tests/Core/DynamicRepositoryTests.cs b/src/GitVersion.Core.Tests/Core/DynamicRepositoryTests.cs index 11f2947dfa..2a490fd4de 100644 --- a/src/GitVersion.Core.Tests/Core/DynamicRepositoryTests.cs +++ b/src/GitVersion.Core.Tests/Core/DynamicRepositoryTests.cs @@ -39,7 +39,18 @@ public void FindsVersionInDynamicRepo(string name, string url, string targetBran }; var options = Options.Create(gitVersionOptions); - var sp = ConfigureServices(services => services.AddSingleton(options)); + // Cloning a fixed commit on a moving remote branch can transiently move HEAD during the + // intermediate normalisation steps (more likely when the machine is under load), which + // trips the HEAD-move safety check. The final state - asserted below - is what matters, + // so disable that guard for this scenario. + var environment = new TestEnvironment(); + environment.SetEnvironmentVariable("IGNORE_NORMALISATION_GIT_HEAD_MOVE", "1"); + + var sp = ConfigureServices(services => + { + services.AddSingleton(options); + services.AddSingleton(environment); + }); sp.DiscoverRepository();