fix: stop cleanup timestamp pruning after the first entry (#377)

The timestamp branch in rmExcept returned after the first directory
entry, so at most one outdated item was ever removed. Replace the early
return with continue so every entry is checked.
This commit is contained in:
Tethys Svensson
2026-08-12 18:12:05 +02:00
committed by GitHub
parent a45951ff88
commit 258712b0b7
6 changed files with 4224 additions and 4222 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
import { f as debug, m as mkdirP, n as create, l as exec, w as which, o as warning, i as info, H as HttpCodes, p as HttpClientError, q as HttpClient, t as isDebug, u as setSecret, B as BearerCredentialHandler, e as error } from './cleanup-BWEbZ6YT.js';
import { f as debug, m as mkdirP, n as create, l as exec, w as which, o as warning, i as info, H as HttpCodes, p as HttpClientError, q as HttpClient, t as isDebug, u as setSecret, B as BearerCredentialHandler, e as error } from './cleanup-BPghO_DY.js';
import * as path from 'path';
import * as crypto from 'crypto';
import * as fs from 'fs';
File diff suppressed because it is too large Load Diff
+6 -5
View File
@@ -34434,10 +34434,10 @@ async function getCacheProvider() {
let cache;
switch (cacheProvider) {
case "github":
cache = await import('./cache-CTfQoCTL.js');
cache = await import('./cache-CtywT2QH.js');
break;
case "warpbuild":
cache = await import('./cache-DC26rUaF.js').then(function (n) { return n.c; });
cache = await import('./cache-DZhpLd9j.js').then(function (n) { return n.c; });
break;
default:
throw new Error(`The \`cache-provider\` \`${cacheProvider}\` is not valid.`);
@@ -35099,8 +35099,9 @@ const ONE_WEEK = 7 * 24 * 3600 * 1000;
/**
* Removes all files or directories in `dirName` matching some criteria.
*
* When the `checkTimestamp` flag is set, this will also remove anything older
* than one week.
* These two modes are mutually exclusive. When the `checkTimestamp` flag is
* set, this will remove anything older than one week and `keepPrefix` is
* ignored.
*
* Otherwise, it will remove everything that does not match any string in the
* `keepPrefix` set.
@@ -35122,7 +35123,7 @@ async function rmExcept(dirName, keepPrefix, checkTimestamp = false) {
if (isOutdated) {
await rm(dir.path, dirent);
}
return;
continue;
}
let name = dirent.name;
// in Cargo's V1 layout, all packages are suffixed by their hash.
+1 -1
View File
@@ -1,4 +1,4 @@
import { e as error, g as getCacheProvider, a as getInput, b as exportVariable, C as CacheConfig, i as info, c as cleanTargetDir, r as reportError, s as setOutput } from './cleanup-BWEbZ6YT.js';
import { e as error, g as getCacheProvider, a as getInput, b as exportVariable, C as CacheConfig, i as info, c as cleanTargetDir, r as reportError, s as setOutput } from './cleanup-BPghO_DY.js';
import 'os';
import 'crypto';
import 'fs';
+1 -1
View File
@@ -1,4 +1,4 @@
import { e as error, g as getCacheProvider, a as getInput, d as isCacheUpToDate, i as info, C as CacheConfig, c as cleanTargetDir, f as debug, h as cleanRegistry, j as cleanBin, k as cleanGit, r as reportError, l as exec } from './cleanup-BWEbZ6YT.js';
import { e as error, g as getCacheProvider, a as getInput, d as isCacheUpToDate, i as info, C as CacheConfig, c as cleanTargetDir, f as debug, h as cleanRegistry, j as cleanBin, k as cleanGit, r as reportError, l as exec } from './cleanup-BPghO_DY.js';
import 'os';
import 'crypto';
import 'fs';
+4 -3
View File
@@ -243,8 +243,9 @@ const ONE_WEEK = 7 * 24 * 3600 * 1000;
/**
* Removes all files or directories in `dirName` matching some criteria.
*
* When the `checkTimestamp` flag is set, this will also remove anything older
* than one week.
* These two modes are mutually exclusive. When the `checkTimestamp` flag is
* set, this will remove anything older than one week and `keepPrefix` is
* ignored.
*
* Otherwise, it will remove everything that does not match any string in the
* `keepPrefix` set.
@@ -267,7 +268,7 @@ async function rmExcept(dirName: string, keepPrefix: Set<string>, checkTimestamp
if (isOutdated) {
await rm(dir.path, dirent);
}
return;
continue;
}
let name = dirent.name;