From 71f4b77450509d640af3a3a9ec97b979fa8dae10 Mon Sep 17 00:00:00 2001 From: Keith Bauson Date: Thu, 4 Dec 2025 12:22:40 -0500 Subject: [PATCH 1/4] try using realpath --- dist/index.js | 2 +- src/git-auth-helper.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index b9b34d3..10dec11 100644 --- a/dist/index.js +++ b/dist/index.js @@ -407,7 +407,7 @@ class GitAuthHelper { } else { // Host git directory - let gitDir = path.join(this.git.getWorkingDirectory(), '.git'); + let gitDir = fs.realpathSync(path.join(this.git.getWorkingDirectory(), '.git')); gitDir = gitDir.replace(/\\/g, '/'); // Use forward slashes, even on Windows // Configure host includeIf const hostIncludeKey = `includeIf.gitdir:${gitDir}.path`; diff --git a/src/git-auth-helper.ts b/src/git-auth-helper.ts index e67db14..7c18894 100644 --- a/src/git-auth-helper.ts +++ b/src/git-auth-helper.ts @@ -367,7 +367,7 @@ class GitAuthHelper { ) } else { // Host git directory - let gitDir = path.join(this.git.getWorkingDirectory(), '.git') + let gitDir = fs.realpathSync(path.join(this.git.getWorkingDirectory(), '.git')) gitDir = gitDir.replace(/\\/g, '/') // Use forward slashes, even on Windows // Configure host includeIf From 1312196d89d650fdfb8f7af57b2725129fd42420 Mon Sep 17 00:00:00 2001 From: Keith Bauson Date: Thu, 4 Dec 2025 12:25:46 -0500 Subject: [PATCH 2/4] format --- src/git-auth-helper.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/git-auth-helper.ts b/src/git-auth-helper.ts index 7c18894..60cd41f 100644 --- a/src/git-auth-helper.ts +++ b/src/git-auth-helper.ts @@ -367,7 +367,9 @@ class GitAuthHelper { ) } else { // Host git directory - let gitDir = fs.realpathSync(path.join(this.git.getWorkingDirectory(), '.git')) + let gitDir = fs.realpathSync( + path.join(this.git.getWorkingDirectory(), '.git') + ) gitDir = gitDir.replace(/\\/g, '/') // Use forward slashes, even on Windows // Configure host includeIf From fb7124daff9724c1a9bcfca0f089ef4454c80098 Mon Sep 17 00:00:00 2001 From: Keith Bauson Date: Thu, 4 Dec 2025 12:46:18 -0500 Subject: [PATCH 3/4] use promise --- dist/index.js | 4 ++-- src/git-auth-helper.ts | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/dist/index.js b/dist/index.js index 10dec11..8a37478 100644 --- a/dist/index.js +++ b/dist/index.js @@ -267,7 +267,7 @@ class GitAuthHelper { // Configure both host and container paths to support Docker container actions. for (const configPath of configPaths) { // 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 // Configure host includeIf yield this.git.config(`includeIf.gitdir:${submoduleGitDir}.path`, credentialsConfigPath, false, // globalConfig? @@ -407,7 +407,7 @@ class GitAuthHelper { } else { // Host git directory - let gitDir = fs.realpathSync(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 // Configure host includeIf const hostIncludeKey = `includeIf.gitdir:${gitDir}.path`; diff --git a/src/git-auth-helper.ts b/src/git-auth-helper.ts index 60cd41f..ddd8862 100644 --- a/src/git-auth-helper.ts +++ b/src/git-auth-helper.ts @@ -177,7 +177,9 @@ class GitAuthHelper { // Configure both host and container paths to support Docker container actions. for (const configPath of configPaths) { // 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 // Configure host includeIf @@ -367,7 +369,7 @@ class GitAuthHelper { ) } else { // Host git directory - let gitDir = fs.realpathSync( + let gitDir = await fs.promises.realpath( path.join(this.git.getWorkingDirectory(), '.git') ) gitDir = gitDir.replace(/\\/g, '/') // Use forward slashes, even on Windows From b952e6d97e8202eea9be8ffdf1362c54c5053f6e Mon Sep 17 00:00:00 2001 From: Keith Bauson Date: Thu, 4 Dec 2025 13:26:04 -0500 Subject: [PATCH 4/4] add a workflow test --- .github/workflows/test.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fe2539f..8cd7ee8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -181,6 +181,25 @@ jobs: with: 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 - name: Remove basic if: runner.os != 'windows'