Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 89a51cfd5b |
@@ -277,11 +277,13 @@ test('hook fixtures do not mutate the calling linked worktree or its index', ()
|
|||||||
writeFileSync(join(worktree, 'sentinel.txt'), 'unstaged\n');
|
writeFileSync(join(worktree, 'sentinel.txt'), 'unstaged\n');
|
||||||
const gitDir = git(worktree, 'rev-parse', '--absolute-git-dir').trim();
|
const gitDir = git(worktree, 'rev-parse', '--absolute-git-dir').trim();
|
||||||
const indexPath = join(gitDir, 'index');
|
const indexPath = join(gitDir, 'index');
|
||||||
|
// `git status` 会刷新并重写索引里的 stat 缓存(macOS 与部分 git 版本上字节必然变化),
|
||||||
|
// 所以先跑完会写索引的探针再取快照,否则断言的是探针自身的副作用而不是被测行为。
|
||||||
const before = {
|
const before = {
|
||||||
refs: git(outerRepo, 'show-ref'),
|
refs: git(outerRepo, 'show-ref'),
|
||||||
config: readFileSync(join(outerRepo, '.git', 'config'), 'utf8'),
|
config: readFileSync(join(outerRepo, '.git', 'config'), 'utf8'),
|
||||||
index: readFileSync(indexPath),
|
|
||||||
status: git(worktree, 'status', '--porcelain'),
|
status: git(worktree, 'status', '--porcelain'),
|
||||||
|
index: readFileSync(indexPath),
|
||||||
};
|
};
|
||||||
const result = spawnSync(
|
const result = spawnSync(
|
||||||
process.execPath,
|
process.execPath,
|
||||||
|
|||||||
Reference in New Issue
Block a user