From de139943d8272773b5f19ed824d687b0232b9ba3 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 11 Mar 2023 09:03:03 +0100 Subject: Adding upstream version 0.19.1. Signed-off-by: Daniel Baumann --- gitlint-core/gitlint/hooks.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'gitlint-core/gitlint/hooks.py') 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." -- cgit v1.2.3