generated from dotnet/new-repo
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Align RepositoryBranch logic with .NET 9 (#50)
Fixes #46 Addresses the difference in behavior between the .NET 9 SDK's version of SourceLink and our own branch logic. Doing so has two implications: 1. We no longer attempt to shorten git refs like `refs/heads/` or `refs/tags/` 2. We prefer the tag over the branch over the PR ID (old logic was PR ID, tag, branch) For code reviewers I suggest reviewing each commit separately, as the first moves the test data and covers all the combinations of values, and the second is the logic and test result change
- Loading branch information
1 parent
94faeb1
commit f2c641c
Showing
6 changed files
with
106 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
tests/DotNet.ReproducibleBuilds.Tests/CollectionExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace DotNet.ReproducibleBuilds.Tests; | ||
|
||
internal static class CollectionExtensions | ||
{ | ||
public static IDisposable ToDisposable(this IEnumerable<IDisposable> disposables) => new DisposableCollection(disposables); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
tests/DotNet.ReproducibleBuilds.Tests/DisposableCollection.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
namespace DotNet.ReproducibleBuilds.Tests; | ||
|
||
internal sealed class DisposableCollection : IDisposable | ||
{ | ||
private readonly List<IDisposable> _disposables = []; | ||
|
||
public DisposableCollection(IEnumerable<IDisposable> disposables) => _disposables.AddRange(disposables); | ||
|
||
public void Add(IDisposable disposable) => _disposables.Add(disposable); | ||
|
||
public void Dispose() | ||
{ | ||
foreach (IDisposable disposable in _disposables) | ||
{ | ||
disposable.Dispose(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters