Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

fix(git): classify commit-push's unmatched paths in one pass (#7984)

garrytan155fa601fe62
diff --git a/src/core/git/commit-push.ts b/src/core/git/commit-push.ts
index ff7609a4eb..f5347dc9f5 100644
--- a/src/core/git/commit-push.ts
+++ b/src/core/git/commit-push.ts
@@ -479,7 +479,8 @@ function commitPaths(root: string, rel: string[], message: string, scope: Commit
const untracked = listed(['ls-files', '--others', '--exclude-standard']);
const deleted = listed(['diff', '--cached', '--no-renames', '--name-only', '--diff-filter=D']);
const matching = (paths: string[]) => rel.filter(spec => paths.some(p => covers(spec, p)));
- const unmatched = rel.filter(spec => !matching([...tracked, ...untracked, ...deleted]).includes(spec));
+ const matched = new Set(matching([...tracked, ...untracked, ...deleted]));
+ const unmatched = rel.filter(spec => !matched.has(spec));
try {
for (const [mode, specs] of [['-u', matching(tracked)], ['-A', matching(untracked)], ['-A', unmatched]] as const) {
if (!specs.length) continue;