feat: enhance findings and exclusions handling with repo state logging

This commit is contained in:
2026-05-15 09:39:11 +00:00
parent 8bf791a829
commit 222de4b369
5 changed files with 107 additions and 10 deletions
+17
View File
@@ -41,6 +41,23 @@ function withAskpass(workspace, fn) {
}
}
function readGitOutput(run, args, cwd, env) {
try {
return run(args, cwd, env);
} catch {
return '';
}
}
export function getRepoState(repoDir, _spawnSync = spawnSync) {
const run = makeRunner(_spawnSync);
const headSha = readGitOutput(run, ['rev-parse', 'HEAD'], repoDir);
const shortSha = readGitOutput(run, ['rev-parse', '--short', 'HEAD'], repoDir);
const branch = readGitOutput(run, ['branch', '--show-current'], repoDir);
const commitTime = readGitOutput(run, ['show', '-s', '--format=%cI', 'HEAD'], repoDir);
return { repoDir, branch, headSha, shortSha, commitTime };
}
/**
* Clone PR head branch to workspace/repo (idempotent)
*/