Skip to content

Commit

Permalink
Fix not picking a ~matching version
Browse files Browse the repository at this point in the history
  • Loading branch information
rasmus committed Dec 8, 2024
1 parent 8c76ae1 commit 393de9d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ public void SetUp()
"1.0.129",
"1.1,1.0-alpha,0.9",
"1.0-alpha")]
[TestCase(
"1.0.0-alpha",
"1.1.0,1.0.0,0.9.0",
"1.0.0")]
public async Task PickExpectedVersion(
string version,
string releaseNoteVersions,
Expand Down
18 changes: 17 additions & 1 deletion Source/Bake/Cooking/Ingredients/Gathers/ReleaseNotesGather.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ private async Task InternalGatherAsync(
.Where(n => n.Version.IsSubset(version))
.OrderByDescending(n => n.Version)
.ToList();

if (withSubset.Any())
{
var notes = withSubset.First();
Expand All @@ -147,6 +146,23 @@ private async Task InternalGatherAsync(
return notes;
}

var withLegacyVersion = releaseNotes
.Where(n => n.Version.LegacyVersion == version.LegacyVersion)
.OrderByDescending(n => n.Version)
.ToList();
if (withLegacyVersion.Any())
{
var notes = withLegacyVersion.First();

_logger.LogInformation(
"Found {Count} release notes that matches the non-meta {Version}, picking the most recent. Got {PickedVersion}",
withLegacyVersion.Count,
version.ToString(),
notes.Version.ToString());

return notes;
}

var orderedReleaseNotes = releaseNotes
.OrderByDescending(n => n.Version)
.ToList();
Expand Down

0 comments on commit 393de9d

Please sign in to comment.