From 8653ca41158b48bae814abeaffd2c582ee4bbd21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stanis=C5=82aw=20Chmiela?= Date: Tue, 11 Jul 2023 14:10:49 +0200 Subject: [PATCH] Fix `prune --older-than` deleting all cache (#549) * Fix `prune --older-than` * Update Sources/tart/Commands/Prune.swift Co-authored-by: Fedor Korotkov --------- Co-authored-by: Fedor Korotkov --- Sources/tart/Commands/Prune.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/tart/Commands/Prune.swift b/Sources/tart/Commands/Prune.swift index e672b5a..ca9dadc 100644 --- a/Sources/tart/Commands/Prune.swift +++ b/Sources/tart/Commands/Prune.swift @@ -34,7 +34,7 @@ struct Prune: AsyncParsableCommand { // Clean up cache entries based on last accessed date if let olderThan = olderThan { let olderThanInterval = Int(exactly: olderThan)!.days.timeInterval - let olderThanDate = Date().addingTimeInterval(olderThanInterval) + let olderThanDate = Date() - olderThanInterval try Prune.pruneOlderThan(olderThanDate: olderThanDate) }