Skip to content

Commit

Permalink
fix: drop option to support earlier Git versions
Browse files Browse the repository at this point in the history
  • Loading branch information
iiroj committed Jun 12, 2024
1 parent a91d942 commit a51be80
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/itchy-shrimps-shake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'lint-staged': patch
---

In the previous version the native `git rev-parse --show-toplevel` command was taken into use for resolving the current git repo root. This version drops the `--path-format=absolute` option to support earlier git versions since it's also the default behavior.
8 changes: 2 additions & 6 deletions lib/resolveGitRepo.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,10 @@ export const resolveGitRepo = async (cwd = process.cwd()) => {
debugLog('Unset GIT_WORK_TREE (was `%s`)', process.env.GIT_WORK_TREE)
delete process.env.GIT_WORK_TREE

const gitDir = normalizePath(
await execGit(['rev-parse', '--path-format=absolute', '--show-toplevel'], { cwd })
)
const gitDir = normalizePath(await execGit(['rev-parse', '--show-toplevel'], { cwd }))
debugLog('Resolved git directory to be `%s`', gitDir)

const gitConfigDir = normalizePath(
await execGit(['rev-parse', '--path-format=absolute', '--absolute-git-dir'], { cwd })
)
const gitConfigDir = normalizePath(await execGit(['rev-parse', '--absolute-git-dir'], { cwd }))
debugLog('Resolved git config directory to be `%s`', gitConfigDir)

return { gitDir, gitConfigDir }
Expand Down

0 comments on commit a51be80

Please sign in to comment.