Skip to content

Commit 314f790

Browse files
authored
Fix fetching eng/common files from the VMR (#4855)
Resolves #4849
1 parent 705d30c commit 314f790

File tree

2 files changed

+8
-56
lines changed

2 files changed

+8
-56
lines changed

src/Microsoft.DotNet.Darc/DarcLib/GitHubClient.cs

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,61 +1099,6 @@ private async Task<TreeResponse> GetTreeForPathAsync(string owner, string repo,
10991099
}
11001100
}
11011101

1102-
private async Task GetCommitMapForPathAsync(
1103-
string repoUri,
1104-
string branch,
1105-
string assetsProducedInCommit,
1106-
List<GitFile> files,
1107-
string pullRequestBaseBranch,
1108-
string path = "eng/common/")
1109-
{
1110-
if (path.EndsWith("/"))
1111-
{
1112-
path = path.Substring(0, path.Length - 1);
1113-
}
1114-
1115-
_logger.LogInformation(
1116-
$"Getting the contents of file/files in '{path}' of repo '{repoUri}' at commit '{assetsProducedInCommit}'");
1117-
1118-
(string owner, string repo) = ParseRepoUri(repoUri);
1119-
List<GitHubContent>? contents;
1120-
1121-
using (HttpResponseMessage response = await ExecuteRemoteGitCommandAsync(
1122-
HttpMethod.Get,
1123-
$"https://github.com/{owner}/{repo}",
1124-
$"repos/{owner}/{repo}/contents/{path}?ref={assetsProducedInCommit}",
1125-
_logger))
1126-
{
1127-
contents = JsonConvert.DeserializeObject<List<GitHubContent>>(await response.Content.ReadAsStringAsync());
1128-
}
1129-
1130-
foreach (GitHubContent content in contents!)
1131-
{
1132-
if (content.Type == GitHubContentType.File)
1133-
{
1134-
if (!DependencyFileManager.DependencyFiles.Contains(content.Path))
1135-
{
1136-
string fileContent = await GetFileContentsAsync(owner, repo, content.Path);
1137-
var gitCommit = new GitFile(content.Path, fileContent);
1138-
files.Add(gitCommit);
1139-
}
1140-
}
1141-
else
1142-
{
1143-
await GetCommitMapForPathAsync(
1144-
repoUri,
1145-
branch,
1146-
assetsProducedInCommit,
1147-
files,
1148-
pullRequestBaseBranch,
1149-
content.Path);
1150-
}
1151-
}
1152-
1153-
_logger.LogInformation(
1154-
$"Getting the contents of file/files in '{path}' of repo '{repoUri}' at commit '{assetsProducedInCommit}' succeeded!");
1155-
}
1156-
11571102
/// <summary>
11581103
/// Parse out the owner and repo from a repository url
11591104
/// </summary>

src/Microsoft.DotNet.Darc/DarcLib/Local.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,14 @@ public async Task UpdateDependenciesAsync(List<DependencyDetail> dependencies, I
102102
// so we need to strip the src/arcade prefix from the file paths.
103103
if (repoIsVmr)
104104
{
105-
engCommonFiles = engCommonFiles.Select(f => new GitFile(f.FilePath.Replace("src/arcade/", null), f.Content)).ToList();
105+
engCommonFiles = engCommonFiles
106+
.Select(f => new GitFile(
107+
f.FilePath.Replace("src/arcade/", null),
108+
f.Content,
109+
f.ContentEncoding,
110+
f.Mode,
111+
f.Operation))
112+
.ToList();
106113
}
107114

108115
filesToUpdate.AddRange(engCommonFiles);

0 commit comments

Comments
 (0)