tamperward 2.39.5 → 2.39.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/cli/index.js +17 -2
  2. package/package.json +1 -1
package/dist/cli/index.js CHANGED
@@ -1239,11 +1239,26 @@ function git(args, cwd) {
1239
1239
  throw new Error(detail ? `git ${args[0]}: ${detail}` : failure.message || `git ${args[0]} failed`);
1240
1240
  }
1241
1241
  }
1242
+ function entryKindAt(rev2, path, cwd) {
1243
+ const listing = rev2 === "" ? git(["ls-files", "-s", "-z", "--", `:(literal)${path}`], cwd) : git(["ls-tree", "-z", rev2, "--", `:(literal)${path}`], cwd);
1244
+ for (const record of listing.split("\0")) {
1245
+ const tab = record.indexOf(" ");
1246
+ if (tab === -1 || record.slice(tab + 1) !== path) continue;
1247
+ const meta2 = record.slice(0, tab).split(" ");
1248
+ const mode = meta2[0] ?? "";
1249
+ const isBlob = rev2 === "" ? mode !== "160000" && !mode.startsWith("04") : meta2[1] === "blob";
1250
+ return isBlob ? "blob" : "other";
1251
+ }
1252
+ return "absent";
1253
+ }
1242
1254
  function blobAt(rev2, path, cwd) {
1243
1255
  try {
1244
1256
  return git(["show", `${rev2}:${path}`], cwd);
1245
- } catch {
1246
- return null;
1257
+ } catch (e) {
1258
+ if (entryKindAt(rev2, path, cwd) !== "blob") return null;
1259
+ const detail = (e instanceof Error ? e.message : String(e)).split("\n")[0];
1260
+ const where = rev2 === "" ? "the index entry " : `${rev2}:`;
1261
+ throw new Error(`cannot read ${where}${path} although the tree lists it as a blob (${detail}); refusing to judge it as absent`);
1247
1262
  }
1248
1263
  }
1249
1264
  function fromDisk(path, cwd) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tamperward",
3
- "version": "2.39.5",
3
+ "version": "2.39.6",
4
4
  "description": "The deterministic agent-integrity gate. One ruleset, evaluated on the actual diff/commands as a verdict, enforced everywhere a change can be made.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "hexrift",