Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Count added toolchain and registry config files

Manav Rathi3f1590eaf60b
diff --git a/.github/scripts/change-approval.mjs b/.github/scripts/change-approval.mjs
index 9ced2b1a2d..cb878696d9 100644
--- a/.github/scripts/change-approval.mjs
+++ b/.github/scripts/change-approval.mjs
@@ -166,7 +166,7 @@ const moved = dependencies.reduce((n, { moved }) => n + moved.length, 0);
const guardrails = kept.filter(
(file) => guardrailDirs.some((dir) => file.startsWith(dir)) || guardrailFiles.has(path.basename(file)),
);
-const configs = kept.filter((file) => configFile.test(file));
+const configs = [...numstat(), ...additions].map(([, , file]) => file).filter((file) => configFile.test(file));
const categories = [
["binary file", "binary files", binaries.length],
diff --git a/.github/scripts/change-approval.test.mjs b/.github/scripts/change-approval.test.mjs
index dadf0c21e6..7a9fdef298 100644
--- a/.github/scripts/change-approval.test.mjs
+++ b/.github/scripts/change-approval.test.mjs
@@ -339,7 +339,7 @@ test("guardrail paths modified or deleted, not added", (t) => {
);
});
-test("toolchain and registry config modified, not added", (t) => {
+test("toolchain and registry config added, modified, or deleted", (t) => {
const output = scan(
t,
{ "web/.npmrc": "", "rust/.cargo/config.toml": "" },
@@ -347,10 +347,16 @@ test("toolchain and registry config modified, not added", (t) => {
);
assert.equal(
output,
- "2 config files\n\n## Toolchain and registry config\n\n- `rust/.cargo/config.toml`\n- `web/.npmrc`\n\n",
+ "3 config files\n\n## Toolchain and registry config\n\n- `.nvmrc`\n- `rust/.cargo/config.toml`\n- `web/.npmrc`\n\n",
);
});
+test("new root .cargo/config.toml is a config file, even untracked", (t) => {
+ const expected = "1 config file\n\n## Toolchain and registry config\n\n- `.cargo/config.toml`\n\n";
+ assert.equal(scan(t, { "a.txt": "a\n" }, { ".cargo/config.toml": "[registries]\n" }), expected);
+ assert.equal(scan(t, { "a.txt": "a\n" }, { ".cargo/config.toml": "[registries]\n" }, { commit: false }), expected);
+});
+
test("uncommitted and untracked changes are scanned locally", (t) => {
const output = scan(
t,