Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the correct .git path in case of worktrees. #2252

Merged
merged 1 commit into from Apr 2, 2022

Conversation

daschuer
Copy link
Contributor

The issue happens because get_git_dir() returns git rev-parse --git-common-dir and not git rev-parse --git-dir as expected. This PR introduces get_git_common_dir() and uses it where the common dir is required and the local .git dir of the current working copy in all other cases.

This fixes #1972, false positives in case of worktrees.

This PR is in the draft state to debug CI issues.

@daschuer daschuer marked this pull request as draft February 17, 2022 22:25
@daschuer daschuer marked this pull request as ready for review February 18, 2022 09:43
@daschuer
Copy link
Contributor Author

All green now!

Copy link
Member

@asottile asottile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes the conflicted state check when using work trees. pre-commit#1972
@asottile asottile merged commit d650160 into pre-commit:main Apr 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

wrong path in case of workdirs
2 participants