pull/2336/merge
Keith Bauson 2025-12-04 13:53:21 -05:00 committed by GitHub
commit f2b2bb6af1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 27 additions and 4 deletions

View File

@ -181,6 +181,25 @@ jobs:
with: with:
args: bash __test__/verify-worktree.sh worktree-test container-worktree-branch args: bash __test__/verify-worktree.sh worktree-test container-worktree-branch
# Credentials when checkout out into symlink
- name: Setup for symlink test
run: mkdir symlink-test-real && ln -s symlink-test-real symlink-test-link
- name: Checkout for worktree test
uses: ./
with:
path: symlink-test-link
- name: Verify symlink credentials
run: |
cd symlink-test-real
if git config --list --show-origin | grep -q "extraheader"; then
echo "Credentials are configured"
else
echo "ERROR: Credentials are NOT configured"
echo "Full git config:"
git config --list --show-origin
exit 1
fi
# Basic checkout using REST API # Basic checkout using REST API
- name: Remove basic - name: Remove basic
if: runner.os != 'windows' if: runner.os != 'windows'

4
dist/index.js vendored
View File

@ -267,7 +267,7 @@ class GitAuthHelper {
// Configure both host and container paths to support Docker container actions. // Configure both host and container paths to support Docker container actions.
for (const configPath of configPaths) { for (const configPath of configPaths) {
// Submodule Git directory // Submodule Git directory
let submoduleGitDir = path.dirname(configPath); // The config file is at .git/modules/submodule-name/config let submoduleGitDir = yield fs.promises.realpath(path.dirname(configPath)); // The config file is at .git/modules/submodule-name/config
submoduleGitDir = submoduleGitDir.replace(/\\/g, '/'); // Use forward slashes, even on Windows submoduleGitDir = submoduleGitDir.replace(/\\/g, '/'); // Use forward slashes, even on Windows
// Configure host includeIf // Configure host includeIf
yield this.git.config(`includeIf.gitdir:${submoduleGitDir}.path`, credentialsConfigPath, false, // globalConfig? yield this.git.config(`includeIf.gitdir:${submoduleGitDir}.path`, credentialsConfigPath, false, // globalConfig?
@ -407,7 +407,7 @@ class GitAuthHelper {
} }
else { else {
// Host git directory // Host git directory
let gitDir = path.join(this.git.getWorkingDirectory(), '.git'); let gitDir = yield fs.promises.realpath(path.join(this.git.getWorkingDirectory(), '.git'));
gitDir = gitDir.replace(/\\/g, '/'); // Use forward slashes, even on Windows gitDir = gitDir.replace(/\\/g, '/'); // Use forward slashes, even on Windows
// Configure host includeIf // Configure host includeIf
const hostIncludeKey = `includeIf.gitdir:${gitDir}.path`; const hostIncludeKey = `includeIf.gitdir:${gitDir}.path`;

View File

@ -177,7 +177,9 @@ class GitAuthHelper {
// Configure both host and container paths to support Docker container actions. // Configure both host and container paths to support Docker container actions.
for (const configPath of configPaths) { for (const configPath of configPaths) {
// Submodule Git directory // Submodule Git directory
let submoduleGitDir = path.dirname(configPath) // The config file is at .git/modules/submodule-name/config let submoduleGitDir = await fs.promises.realpath(
path.dirname(configPath)
) // The config file is at .git/modules/submodule-name/config
submoduleGitDir = submoduleGitDir.replace(/\\/g, '/') // Use forward slashes, even on Windows submoduleGitDir = submoduleGitDir.replace(/\\/g, '/') // Use forward slashes, even on Windows
// Configure host includeIf // Configure host includeIf
@ -367,7 +369,9 @@ class GitAuthHelper {
) )
} else { } else {
// Host git directory // Host git directory
let gitDir = path.join(this.git.getWorkingDirectory(), '.git') let gitDir = await fs.promises.realpath(
path.join(this.git.getWorkingDirectory(), '.git')
)
gitDir = gitDir.replace(/\\/g, '/') // Use forward slashes, even on Windows gitDir = gitDir.replace(/\\/g, '/') // Use forward slashes, even on Windows
// Configure host includeIf // Configure host includeIf