Skip to content

Commit 8dd898e

Browse files
committed
Set Lib2Git Config SearchPaths to Empty for Global\System level. This is avoid Lib2Git to lookup and read these files when building
1 parent 87bb7e0 commit 8dd898e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/NerdBank.GitVersioning/VersionOracle.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,11 @@ private static LibGit2Sharp.Repository OpenGitRepo(string repoRoot)
363363
{
364364
Requires.NotNullOrEmpty(repoRoot, nameof(repoRoot));
365365
var gitDir = FindGitDir(repoRoot);
366+
367+
// Override Config Search paths to empty path to avoid new Repository instance to lookup for Global\System .gitconfig file
368+
LibGit2Sharp.GlobalSettings.SetConfigSearchPaths(LibGit2Sharp.ConfigurationLevel.Global, string.Empty);
369+
LibGit2Sharp.GlobalSettings.SetConfigSearchPaths(LibGit2Sharp.ConfigurationLevel.System, string.Empty);
370+
366371
return gitDir == null ? null : new LibGit2Sharp.Repository(gitDir);
367372
}
368373

0 commit comments

Comments
 (0)