diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-03-11 08:03:03 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-03-11 08:03:03 +0000 |
commit | de139943d8272773b5f19ed824d687b0232b9ba3 (patch) | |
tree | 47e73755bffd41bdde2d59d76cc595f5a1fa75d4 /gitlint-core/gitlint/hooks.py | |
parent | Adding upstream version 0.19.0~dev. (diff) | |
download | gitlint-upstream.tar.xz gitlint-upstream.zip |
Adding upstream version 0.19.1.upstream/0.19.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gitlint-core/gitlint/hooks.py')
-rw-r--r-- | gitlint-core/gitlint/hooks.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/gitlint-core/gitlint/hooks.py b/gitlint-core/gitlint/hooks.py index 78c5e46..98ded18 100644 --- a/gitlint-core/gitlint/hooks.py +++ b/gitlint-core/gitlint/hooks.py @@ -1,10 +1,10 @@ -import shutil import os +import shutil import stat -from gitlint.utils import DEFAULT_ENCODING -from gitlint.git import git_hooks_dir from gitlint.exception import GitlintError +from gitlint.git import git_hooks_dir +from gitlint.utils import FILE_ENCODING COMMIT_MSG_HOOK_SRC_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), "files", "commit-msg") COMMIT_MSG_HOOK_DST_PATH = "commit-msg" @@ -52,9 +52,9 @@ class GitHookInstaller: if not os.path.exists(dest_path): raise GitHookInstallerError(f"There is no commit-msg hook present in {dest_path}.") - with open(dest_path, encoding=DEFAULT_ENCODING) as fp: + with open(dest_path, encoding=FILE_ENCODING) as fp: lines = fp.readlines() - if len(lines) < 2 or lines[1] != GITLINT_HOOK_IDENTIFIER: + if len(lines) < 2 or lines[1] != GITLINT_HOOK_IDENTIFIER: # noqa: PLR2004 (Magic value used in comparison) msg = ( f"The commit-msg hook in {dest_path} was not installed by gitlint (or it was modified).\n" "Uninstallation of 3th party or modified gitlint hooks is not supported." |