fix(GOV-009): 完成最终复审整改
This commit is contained in:
@@ -8,6 +8,18 @@ import { fileURLToPath } from 'node:url';
|
||||
* 避免用户其他工作区改动干扰契约门禁。
|
||||
*/
|
||||
export function assertGeneratedContractsUnchanged(repositoryRoot, contractFiles) {
|
||||
for (const contractFile of contractFiles) {
|
||||
try {
|
||||
execFileSync('git', ['ls-files', '--error-unmatch', '--', contractFile], {
|
||||
cwd: repositoryRoot,
|
||||
encoding: 'utf8',
|
||||
stdio: ['ignore', 'ignore', 'pipe'],
|
||||
});
|
||||
} catch {
|
||||
throw new Error(`生成契约未纳入 Git 跟踪:${contractFile}`);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
execFileSync('git', ['diff', '--exit-code', '--', ...contractFiles], {
|
||||
cwd: repositoryRoot,
|
||||
|
||||
Reference in New Issue
Block a user