Skip to content
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

SourceLink patch debugging #1773

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view

This file was deleted.

@@ -0,0 +1,34 @@
From 94b74dcdde1787617d8665e231334f089c01ce24 Mon Sep 17 00:00:00 2001
From: Chris Rummel <crummel@microsoft.com>
Date: Tue, 4 Aug 2020 20:28:53 -0500
Subject: [PATCH 5/5] Allow using .git directory instead of gitdir redirect in
submodules.

---
.../GitDataReader/GitRepository.cs | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/src/Microsoft.Build.Tasks.Git/GitDataReader/GitRepository.cs b/src/Microsoft.Build.Tasks.Git/GitDataReader/GitRepository.cs
index 196c57d..e1ab9c4 100644
--- a/src/Microsoft.Build.Tasks.Git/GitDataReader/GitRepository.cs
+++ b/src/Microsoft.Build.Tasks.Git/GitDataReader/GitRepository.cs
@@ -209,6 +209,16 @@ private string ReadHeadCommitSha()
/// <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 can when Arcade uberclone
+ // was used. Handle this case first since the other case throws.
+ var dotGitPath = Path.Combine(submoduleWorkingDirectoryFullPath, GitDirName);
+ if (IsGitDirectory(dotGitPath, out var directSubmoduleGitDirectory))
+ {
+ var submoduleGitDirResolver = new GitReferenceResolver(directSubmoduleGitDirectory, submoduleWorkingDirectoryFullPath);
+ return submoduleGitDirResolver.ResolveHeadReference();
+ }
+
+ // normal-looking submodule gitdir redirect, or a repo broken in some other way.
var gitDirectory = ReadDotGitFile(Path.Combine(submoduleWorkingDirectoryFullPath, GitDirName));
if (!IsGitDirectory(gitDirectory, out var commonDirectory))
{
--
2.18.0

This file was deleted.