use promise

This commit is contained in:
Keith Bauson 2025-12-04 12:46:18 -05:00
parent 1312196d89
commit fb7124daff
2 changed files with 6 additions and 4 deletions

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 = 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 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,7 @@ class GitAuthHelper {
) )
} else { } else {
// Host git directory // Host git directory
let gitDir = fs.realpathSync( let gitDir = await fs.promises.realpath(
path.join(this.git.getWorkingDirectory(), '.git') 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