feat: enhance findings and exclusions handling with repo state logging
This commit is contained in:
+17
@@ -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)
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user