mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-14 04:17:33 +01:00
fix(state-matrix): detect reads the native diff, ignoring diff.external and textconv (review #3235 P1-4)
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
ea49e49d74
commit
efccf00778
2 files changed
+11
-1
No files matched your search
@@ -43,7 +43,7 @@ function detect(rest: string[]): number {
|
||||
const repoRoot = root.out.trim();
|
||||
const base = resolveBaseBranch(repoRoot, flag(rest, '--base'));
|
||||
const mb = flag(rest, '--diff-base') ?? git(['merge-base', `origin/${base}`, 'HEAD'], repoRoot).out.trim();
|
||||
const diff = mb ? git(['diff', '--unified=0', '--no-color', mb], repoRoot) : { ok: false, out: '' };
|
||||
const diff = mb ? git(['-c', 'core.quotePath=false', 'diff', '--no-ext-diff', '--no-textconv', '--unified=0', '--no-color', mb], repoRoot) : { ok: false, out: '' };
|
||||
if (!diff.ok) { process.stdout.write(`SCOPE_STATE_MACHINE=false\n# no merge base with origin/${base}; run: git fetch origin ${base}\n`); return EXIT.usage; }
|
||||
const { detected, hits } = detectStateMachine(addedLines(diff.out));
|
||||
const lines = [`SCOPE_STATE_MACHINE=${detected}`, ...hits.slice(0, 12).map(h => `# state-machine: ${h.file}:${h.line} ${[...h.subject, ...h.action].join(',')}`)];
|
||||
|
||||
Reference in new issue
Block a user