Detect git worktrees correctly
Git worktrees are represented as a file named .git, with contents that look like: gitdir: E:/cli/.git/worktrees/cli2
This commit is contained in:
parent
e3d388e82d
commit
ca848eddd3
1 changed files with 7 additions and 2 deletions
|
@ -37,9 +37,14 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
|||
string directory = AppContext.BaseDirectory;
|
||||
#endif
|
||||
|
||||
while (!Directory.Exists(Path.Combine(directory, ".git")) && directory != null)
|
||||
while (directory != null)
|
||||
{
|
||||
directory = Directory.GetParent(directory).FullName;
|
||||
var gitDirOrFile = Path.Combine(directory, ".git");
|
||||
if (Directory.Exists(gitDirOrFile) || File.Exists(gitDirOrFile))
|
||||
{
|
||||
break;
|
||||
}
|
||||
directory = Directory.GetParent(directory)?.FullName;
|
||||
}
|
||||
|
||||
if (directory == null)
|
||||
|
|
Loading…
Add table
Reference in a new issue