Skip to content

Commit 8994c09

Browse files
committed
Add more details to the comments about how this case can happen.
1 parent 3a62f1b commit 8994c09

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Microsoft.Build.Tasks.Git/GitDataReader/GitRepository.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,10 @@ public static GitRepository OpenRepository(GitRepositoryLocation location, GitEn
209209
/// <returns>Null if the HEAD tip reference can't be resolved.</returns>
210210
internal string? ReadSubmoduleHeadCommitSha(string submoduleWorkingDirectoryFullPath)
211211
{
212-
// submodules don't usually have their own .git directories but this is still legal.
213-
// see https://git-scm.com/docs/gitsubmodules#_forms for more details.
212+
// Submodules don't usually have their own .git directories but this is still legal.
213+
// This can occur with older versions of Git or other tools, or when a user clones one
214+
// repo into another's source tree (but it was not yet registered as a submodule).
215+
// See https://git-scm.com/docs/gitsubmodules#_forms for more details.
214216
// Handle this case first since the other case throws.
215217
var dotGitPath = Path.Combine(submoduleWorkingDirectoryFullPath, GitDirName);
216218
if (IsGitDirectory(dotGitPath, out var directSubmoduleGitDirectory))

0 commit comments

Comments
 (0)