Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/Verify/Verifier/VerifyEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ async Task Inner(FilePair file, Target target)
HandleCompareResult(result, file);
}

foreach (var group in targetList.GroupBy(_ => $"{_.Name}:{_.Extension}"))
foreach (var group in targetList.GroupBy(_ => _, TargetNameExtensionComparer.Instance))
{
var targets = group.ToList();
if (targets.Count == 1)
Expand Down Expand Up @@ -290,4 +290,15 @@ static void AcceptChanges(in FilePair file)
File.Delete(file.VerifiedPath);
File.Move(file.ReceivedPath, file.VerifiedPath);
}

private sealed class TargetNameExtensionComparer : IEqualityComparer<Target>
{
public static readonly TargetNameExtensionComparer Instance = new();

public bool Equals(Target x, Target y) =>
(x.Name ?? "") == (y.Name ?? "") && x.Extension == y.Extension;

public int GetHashCode(Target obj) =>
(obj.Name ?? "", obj.Extension).GetHashCode();
}
}
Loading