Skip to content

Commit c711261

Browse files
authored
Support git worktrees by allowing .git to be a file (#139)
1 parent ce36561 commit c711261

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Common/MSBuildCachePluginBase.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,8 +1071,9 @@ private bool TryAcquireLock(PluginSettings settings, PluginLoggerBase logger)
10711071

10721072
static string? GetRepoRootInternal(string path)
10731073
{
1074-
string gitDir = Path.Combine(path, ".git");
1075-
if (Directory.Exists(gitDir))
1074+
// Note: When using git worktrees, .git may be a file instead of a directory.
1075+
string gitPath = Path.Combine(path, ".git");
1076+
if (Directory.Exists(gitPath) || File.Exists(gitPath))
10761077
{
10771078
return path;
10781079
}

0 commit comments

Comments
 (0)