Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
4 changes: 2 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down Expand Up @@ -407,7 +407,7 @@ class GitAuthHelper {
}
else {
// 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
// Configure host includeIf
const hostIncludeKey = `includeIf.gitdir:${gitDir}.path`;
Expand Down
8 changes: 6 additions & 2 deletions src/git-auth-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -367,7 +369,9 @@ class GitAuthHelper {
)
} else {
// 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

// Configure host includeIf
Expand Down