Skip to content

Commit

Permalink
Add more details to the comments about how this case can happen.
Browse files Browse the repository at this point in the history
  • Loading branch information
crummel committed Oct 6, 2020
1 parent 3a62f1b commit 8994c09
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Microsoft.Build.Tasks.Git/GitDataReader/GitRepository.cs
Expand Up @@ -209,8 +209,10 @@ public static GitRepository OpenRepository(GitRepositoryLocation location, GitEn
/// <returns>Null if the HEAD tip reference can't be resolved.</returns>
internal string? ReadSubmoduleHeadCommitSha(string submoduleWorkingDirectoryFullPath)
{
// submodules don't usually have their own .git directories but this is still legal.
// see https://git-scm.com/docs/gitsubmodules#_forms for more details.
// Submodules don't usually have their own .git directories but this is still legal.
// This can occur with older versions of Git or other tools, or when a user clones one
// repo into another's source tree (but it was not yet registered as a submodule).
// See https://git-scm.com/docs/gitsubmodules#_forms for more details.
// Handle this case first since the other case throws.
var dotGitPath = Path.Combine(submoduleWorkingDirectoryFullPath, GitDirName);
if (IsGitDirectory(dotGitPath, out var directSubmoduleGitDirectory))
Expand Down

0 comments on commit 8994c09

Please sign in to comment.