Skip to content

Commit 3b5251d

Browse files
authored
Implement reftable reference resolution (#1498)
* Implement support for reftable * Fix GitVariableName hashing
1 parent 8b88030 commit 3b5251d

24 files changed

+2810
-155
lines changed

eng/Version.Details.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ This file should be imported by eng/Versions.props
88
<!-- dotnet/dotnet dependencies -->
99
<MicrosoftDotNetArcadeSdkPackageVersion>10.0.0-beta.25506.103</MicrosoftDotNetArcadeSdkPackageVersion>
1010
<SystemCommandLinePackageVersion>2.0.0</SystemCommandLinePackageVersion>
11+
<SystemIOHashingPackageVersion>10.0.0-rc.2.25502.107</SystemIOHashingPackageVersion>
1112
<!-- dotnet/msbuild dependencies -->
1213
<MicrosoftBuildPackageVersion>17.11.31</MicrosoftBuildPackageVersion>
1314
<MicrosoftBuildTasksCorePackageVersion>17.11.31</MicrosoftBuildTasksCorePackageVersion>

eng/Version.Details.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,9 @@
2121
<Uri>https://github.com/dotnet/msbuild</Uri>
2222
<Sha>933b72e36e86c22ba73e8b8148488f8298bb73c7</Sha>
2323
</Dependency>
24+
<Dependency Name="System.IO.Hashing" Version="10.0.0-rc.2.25502.107">
25+
<Uri>https://github.com/dotnet/dotnet</Uri>
26+
<Sha>be28ec777bf12db631725399c442448d52093087</Sha>
27+
</Dependency>
2428
</ToolsetDependencies>
2529
</Dependencies>

src/Directory.Packages.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
<!-- Runtime dependencies -->
2424
<PackageVersion Include="System.Text.Json" Version="$(SystemTextJsonVersion)" />
25+
<PackageVersion Include="System.IO.Hashing" Version="$(SystemIOHashingPackageVersion)" />
2526
</ItemGroup>
2627

2728
<!-- External dependencies -->

src/Microsoft.Build.Tasks.Git.UnitTests/GitConfigTests.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the License.txt file in the project root for more information.
4+
45
using System;
56
using System.Collections.Generic;
7+
using System.Collections.Immutable;
68
using System.IO;
79
using System.Linq;
810
using System.Text;
@@ -448,5 +450,30 @@ public void TryParseBooleanValue_Error(string? str)
448450
{
449451
Assert.False(GitConfig.TryParseBooleanValue(str, out _));
450452
}
453+
454+
[Theory]
455+
[InlineData(null, ReferenceStorageFormat.LooseFiles)]
456+
[InlineData("reftable", ReferenceStorageFormat.RefTable)]
457+
internal void RefStorage(string? value, ReferenceStorageFormat expected)
458+
{
459+
var variables = ImmutableDictionary<GitVariableName, ImmutableArray<string>>.Empty;
460+
if (value != null)
461+
{
462+
variables = variables.Add(new GitVariableName("extensions", "", "refStorage"), [value]);
463+
}
464+
465+
Assert.Equal(expected, new GitConfig(variables).ReferenceStorageFormat);
466+
}
467+
468+
[Theory]
469+
[InlineData("")]
470+
[InlineData("x")]
471+
[InlineData("refTable")]
472+
public void RefStorage_Invalid(string value)
473+
{
474+
Assert.Throws<InvalidDataException>(() =>
475+
new GitConfig(ImmutableDictionary<GitVariableName, ImmutableArray<string>>.Empty
476+
.Add(new GitVariableName("extensions", "", "refStorage"), [value])));
477+
}
451478
}
452479
}

0 commit comments

Comments
 (0)