Skip to content

Commit d37d3d2

Browse files
author
theguy000
committed
feat: Recheck version before updating (fixes #3791)
1 parent 2362b5c commit d37d3d2

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

src/UniGetUI.PackageEngine.Operations/PackageOperations.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,16 @@ public UpdatePackageOperation(
242242
bool IgnoreParallelInstalls = false,
243243
AbstractOperation? req = null)
244244
: base(package, options, OperationType.Update, IgnoreParallelInstalls, req)
245-
{ }
245+
{
246+
OperationStarting += (s, e) =>
247+
{
248+
if (package.NewerVersionIsInstalled())
249+
{
250+
Line($"Package {package.Name} is already up-to-date, skipping update.", Core.Tools.LineType.Information);
251+
Cancel();
252+
}
253+
};
254+
}
246255

247256
protected override Task HandleFailure()
248257
{

src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Classes/PackageCacher.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public static bool NewerVersionIsInstalled(Package other)
102102
{
103103
foreach (Package found in __installed_pkgs.Values)
104104
{
105-
if (found.IsEquivalentTo(other) && found.NormalizedVersion == other.NormalizedNewVersion)
105+
if (found.IsEquivalentTo(other) && found.NormalizedVersion >= other.NormalizedNewVersion)
106106
{
107107
return true;
108108
}

0 commit comments

Comments
 (0)