Fix CI test failures by configuring git user in worktree clones
Shared clones created with 'git clone --shared' have independent .git directories and don't inherit config from the source repository. This caused 'Author identity unknown' errors when tests tried to commit in worktree directories. Now configure git user.name and user.email in each worktree directory immediately after creation.
This commit is contained in:
parent
e7a1012050
commit
1b0a84601d
@ -54,6 +54,10 @@ describe('worktree branch deletion', () => {
|
|||||||
worktreeDir = join(tmpdir(), branchSlug);
|
worktreeDir = join(tmpdir(), branchSlug);
|
||||||
execFileSync('git', ['clone', '--shared', testDir, worktreeDir]);
|
execFileSync('git', ['clone', '--shared', testDir, worktreeDir]);
|
||||||
|
|
||||||
|
// Configure git user in worktree (shared clones don't inherit config)
|
||||||
|
execFileSync('git', ['config', 'user.name', 'Test User'], { cwd: worktreeDir });
|
||||||
|
execFileSync('git', ['config', 'user.email', 'test@example.com'], { cwd: worktreeDir });
|
||||||
|
|
||||||
const branchName = `takt/${branchSlug}`;
|
const branchName = `takt/${branchSlug}`;
|
||||||
execFileSync('git', ['checkout', '-b', branchName], { cwd: worktreeDir });
|
execFileSync('git', ['checkout', '-b', branchName], { cwd: worktreeDir });
|
||||||
|
|
||||||
@ -112,6 +116,10 @@ describe('worktree branch deletion', () => {
|
|||||||
worktreeDir = join(tmpdir(), branchSlug);
|
worktreeDir = join(tmpdir(), branchSlug);
|
||||||
execFileSync('git', ['clone', '--shared', testDir, worktreeDir]);
|
execFileSync('git', ['clone', '--shared', testDir, worktreeDir]);
|
||||||
|
|
||||||
|
// Configure git user in worktree (shared clones don't inherit config)
|
||||||
|
execFileSync('git', ['config', 'user.name', 'Test User'], { cwd: worktreeDir });
|
||||||
|
execFileSync('git', ['config', 'user.email', 'test@example.com'], { cwd: worktreeDir });
|
||||||
|
|
||||||
const branchName = `takt/${branchSlug}`;
|
const branchName = `takt/${branchSlug}`;
|
||||||
execFileSync('git', ['checkout', '-b', branchName], { cwd: worktreeDir });
|
execFileSync('git', ['checkout', '-b', branchName], { cwd: worktreeDir });
|
||||||
|
|
||||||
|
|||||||
@ -55,6 +55,10 @@ describe('worktree-sessions recognition', () => {
|
|||||||
// Create shared clone
|
// Create shared clone
|
||||||
execFileSync('git', ['clone', '--shared', testDir, worktreeDir]);
|
execFileSync('git', ['clone', '--shared', testDir, worktreeDir]);
|
||||||
|
|
||||||
|
// Configure git user in worktree (shared clones don't inherit config)
|
||||||
|
execFileSync('git', ['config', 'user.name', 'Test User'], { cwd: worktreeDir });
|
||||||
|
execFileSync('git', ['config', 'user.email', 'test@example.com'], { cwd: worktreeDir });
|
||||||
|
|
||||||
// Create and checkout takt branch in worktree
|
// Create and checkout takt branch in worktree
|
||||||
const branchName = `takt/${branchSlug}`;
|
const branchName = `takt/${branchSlug}`;
|
||||||
execFileSync('git', ['checkout', '-b', branchName], { cwd: worktreeDir });
|
execFileSync('git', ['checkout', '-b', branchName], { cwd: worktreeDir });
|
||||||
@ -109,6 +113,10 @@ describe('worktree-sessions recognition', () => {
|
|||||||
worktreeDir = join(tmpdir(), branchSlug);
|
worktreeDir = join(tmpdir(), branchSlug);
|
||||||
execFileSync('git', ['clone', '--shared', testDir, worktreeDir]);
|
execFileSync('git', ['clone', '--shared', testDir, worktreeDir]);
|
||||||
|
|
||||||
|
// Configure git user in worktree (shared clones don't inherit config)
|
||||||
|
execFileSync('git', ['config', 'user.name', 'Test User'], { cwd: worktreeDir });
|
||||||
|
execFileSync('git', ['config', 'user.email', 'test@example.com'], { cwd: worktreeDir });
|
||||||
|
|
||||||
const branchName = `takt/${branchSlug}`;
|
const branchName = `takt/${branchSlug}`;
|
||||||
execFileSync('git', ['checkout', '-b', branchName], { cwd: worktreeDir });
|
execFileSync('git', ['checkout', '-b', branchName], { cwd: worktreeDir });
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user