-
Notifications
You must be signed in to change notification settings - Fork 132
Allow using .git directory instead of gitdir redirect in submodules. #653
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
6b88ba1
d7ad81a
3a62f1b
8994c09
88e7e5e
941e41d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -209,8 +209,19 @@ public static GitRepository OpenRepository(GitRepositoryLocation location, GitEn | |
| /// <returns>Null if the HEAD tip reference can't be resolved.</returns> | ||
| internal string? ReadSubmoduleHeadCommitSha(string submoduleWorkingDirectoryFullPath) | ||
| { | ||
| var gitDirectory = ReadDotGitFile(Path.Combine(submoduleWorkingDirectoryFullPath, GitDirName)); | ||
| if (!IsGitDirectory(gitDirectory, out var commonDirectory)) | ||
| // 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); | ||
crummel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| var gitDirectory = | ||
| Directory.Exists(dotGitPath) ? dotGitPath : | ||
| File.Exists(dotGitPath) ? ReadDotGitFile(dotGitPath) : | ||
|
||
| null; | ||
|
|
||
| if (gitDirectory == null || !IsGitDirectory(gitDirectory, out var commonDirectory)) | ||
| { | ||
| return null; | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.