mirror of
https://code.forgejo.org/actions/checkout.git
synced 2026-06-27 07:08:53 +00:00
Merge e1d91899ae into f9e715a95f
This commit is contained in:
commit
709f695694
3 changed files with 34 additions and 2 deletions
|
|
@ -902,6 +902,25 @@ describe('git-auth-helper tests', () => {
|
|||
}
|
||||
})
|
||||
|
||||
const configureGlobalAuth_overridesGitConfigGlobal =
|
||||
'configureGlobalAuth overrides GIT_CONFIG_GLOBAL'
|
||||
it(configureGlobalAuth_overridesGitConfigGlobal, async () => {
|
||||
// Arrange
|
||||
await setup(configureGlobalAuth_overridesGitConfigGlobal)
|
||||
const authHelper = gitAuthHelper.createAuthHelper(git, settings)
|
||||
|
||||
// Act
|
||||
await authHelper.configureAuth()
|
||||
await authHelper.configureGlobalAuth()
|
||||
|
||||
// Assert GIT_CONFIG_GLOBAL is pinned to the temporary global config, so an
|
||||
// inherited GIT_CONFIG_GLOBAL cannot redirect --global writes
|
||||
expect(git.env['HOME']).toBeTruthy()
|
||||
expect(git.env['GIT_CONFIG_GLOBAL']).toBe(
|
||||
path.join(git.env['HOME'], '.gitconfig')
|
||||
)
|
||||
})
|
||||
|
||||
const removeGlobalConfig_removesOverride =
|
||||
'removeGlobalConfig removes override'
|
||||
it(removeGlobalConfig_removesOverride, async () => {
|
||||
|
|
@ -912,6 +931,7 @@ describe('git-auth-helper tests', () => {
|
|||
await authHelper.configureGlobalAuth()
|
||||
const homeOverride = git.env['HOME'] // Sanity check
|
||||
expect(homeOverride).toBeTruthy()
|
||||
expect(git.env['GIT_CONFIG_GLOBAL']).toBeTruthy()
|
||||
await fs.promises.stat(path.join(git.env['HOME'], '.gitconfig'))
|
||||
|
||||
// Act
|
||||
|
|
@ -919,6 +939,7 @@ describe('git-auth-helper tests', () => {
|
|||
|
||||
// Assert
|
||||
expect(git.env['HOME']).toBeUndefined()
|
||||
expect(git.env['GIT_CONFIG_GLOBAL']).toBeUndefined()
|
||||
try {
|
||||
await fs.promises.stat(homeOverride)
|
||||
throw new Error(`Should have been deleted '${homeOverride}'`)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue