Skip to content

Commit

Permalink
revert: revert issue with safe directories
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesIves committed Sep 27, 2024
1 parent bb65cf3 commit a96ffa2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 22 deletions.
8 changes: 4 additions & 4 deletions __tests__/git.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe('git', () => {
})

await init(action)
expect(execute).toHaveBeenCalledTimes(8)
expect(execute).toHaveBeenCalledTimes(7)
})

it('should catch when a function throws an error', async () => {
Expand Down Expand Up @@ -101,7 +101,7 @@ describe('git', () => {
})

await init(action)
expect(execute).toHaveBeenCalledTimes(8)
expect(execute).toHaveBeenCalledTimes(7)
})

it('should not unset git config if a user is using ssh', async () => {
Expand All @@ -123,7 +123,7 @@ describe('git', () => {
})

await init(action)
expect(execute).toHaveBeenCalledTimes(7)
expect(execute).toHaveBeenCalledTimes(6)

process.env.CI = undefined
})
Expand All @@ -144,7 +144,7 @@ describe('git', () => {
})

await init(action)
expect(execute).toHaveBeenCalledTimes(8)
expect(execute).toHaveBeenCalledTimes(7)
})
})

Expand Down
4 changes: 2 additions & 2 deletions __tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe('main', () => {
debug: true
})
await run(action)
expect(execute).toHaveBeenCalledTimes(19)
expect(execute).toHaveBeenCalledTimes(18)
expect(rmRF).toHaveBeenCalledTimes(1)
expect(exportVariable).toHaveBeenCalledTimes(1)
})
Expand All @@ -73,7 +73,7 @@ describe('main', () => {
isTest: TestFlag.HAS_CHANGED_FILES
})
await run(action)
expect(execute).toHaveBeenCalledTimes(22)
expect(execute).toHaveBeenCalledTimes(21)
expect(rmRF).toHaveBeenCalledTimes(1)
expect(exportVariable).toHaveBeenCalledTimes(1)
})
Expand Down
17 changes: 1 addition & 16 deletions src/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,7 @@ export async function init(action: ActionInterface): Promise<void | Error> {
info('Configuring git…')

/**
* Add safe directory to the global git config.
*/
try {
await execute(
`git config --global safe.directory '*'`,
action.workspace,
action.silent
)
} catch {
info('Unable to set workflow file tree as a safe directory…')
}

/**
* Ensure that the workspace is a safe directory, this is somewhat redundant as the action
* will always set the workspace as a safe directory, but this is a fallback in case the action
* fails to do so.
* Ensure that the workspace is a safe directory.
*/
try {
await execute(
Expand Down

0 comments on commit a96ffa2

Please sign in to comment.