Merge pull request #6933 from khyperia/git_dir_sometimes_file
Detect git worktrees correctly
This commit is contained in:
commit
670d8f585d
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