Skip to content

The agent that grows with you

perf(tools): stop safe git commands spawning alias-lookup subprocesses

kshitijcd869f26f336
diff --git a/tools/self_repo_guard.py b/tools/self_repo_guard.py
index abe3e33f720..32d3641f29e 100644
--- a/tools/self_repo_guard.py
+++ b/tools/self_repo_guard.py
@@ -39,6 +39,14 @@ _KNOWN_GIT_BUILTINS = frozenset({
"blame",
"branch",
"bundle",
+ "cat-file",
+ # `reset`/`stash`/`clean`/`restore` reach this set only in their SAFE
+ # forms — _mutates_worktree classifies the dangerous forms first (see
+ # _inspect_git) — so listing them here only prevents a pointless
+ # `git config --get alias.<sub>` subprocess for `stash list`,
+ # `reset --soft`, `clean -n`, `restore --staged`, which agent dev
+ # sessions run constantly inside the source repo.
+ "clean",
"clone",
"commit",
"config",
@@ -50,18 +58,28 @@ _KNOWN_GIT_BUILTINS = frozenset({
"help",
"init",
"log",
+ "ls-files",
+ "ls-remote",
+ "ls-tree",
"maintenance",
+ "merge-base",
"mv",
"notes",
"push",
"range-diff",
+ "reflog",
"remote",
"repack",
"replace",
+ "reset",
+ "restore",
"rev-list",
"rev-parse",
"rm",
+ "shortlog",
"show",
+ "show-ref",
+ "stash",
"status",
"submodule",
"tag",