Add worktree support for persist-credentials includeIf (#2327) · actions/checkout@033fa0d

@@ -412,6 +412,9 @@ class GitAuthHelper {

412412

// Configure host includeIf

413413

const hostIncludeKey = `includeIf.gitdir:${gitDir}.path`;

414414

yield this.git.config(hostIncludeKey, credentialsConfigPath);

415+

// Configure host includeIf for worktrees

416+

const hostWorktreeIncludeKey = `includeIf.gitdir:${gitDir}/worktrees/*.path`;

417+

yield this.git.config(hostWorktreeIncludeKey, credentialsConfigPath);

415418

// Container git directory

416419

const workingDirectory = this.git.getWorkingDirectory();

417420

const githubWorkspace = process.env['GITHUB_WORKSPACE'];

@@ -424,6 +427,9 @@ class GitAuthHelper {

424427

// Configure container includeIf

425428

const containerIncludeKey = `includeIf.gitdir:${containerGitDir}.path`;

426429

yield this.git.config(containerIncludeKey, containerCredentialsPath);

430+

// Configure container includeIf for worktrees

431+

const containerWorktreeIncludeKey = `includeIf.gitdir:${containerGitDir}/worktrees/*.path`;

432+

yield this.git.config(containerWorktreeIncludeKey, containerCredentialsPath);

427433

}

428434

});

429435

}