Mercurial > kallithea
changeset 8738:7b809e4a1ea5
git: don't force exact mode on Git hooks when making them executable - use umask
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Wed, 04 Nov 2020 14:30:48 +0100 |
parents | 1089fac66e81 |
children | f3e91cd075eb |
files | kallithea/lib/utils2.py kallithea/model/scm.py |
diffstat | 2 files changed, 7 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/lib/utils2.py Wed Nov 04 13:17:27 2020 +0100 +++ b/kallithea/lib/utils2.py Wed Nov 04 14:30:48 2020 +0100 @@ -80,6 +80,11 @@ assert LazyProperty +# get current umask value without changing it +umask = os.umask(0) +os.umask(umask) + + def convert_line_endings(line, mode): """ Converts a given line "line end" according to given mode
--- a/kallithea/model/scm.py Wed Nov 04 13:17:27 2020 +0100 +++ b/kallithea/model/scm.py Wed Nov 04 14:30:48 2020 +0100 @@ -41,7 +41,7 @@ from kallithea.lib.exceptions import IMCCommitError, NonRelativePathError from kallithea.lib.hooks import process_pushed_raw_ids from kallithea.lib.utils import action_logger, get_filesystem_repos, make_ui -from kallithea.lib.utils2 import safe_bytes, safe_str, set_hook_environment +from kallithea.lib.utils2 import safe_bytes, safe_str, set_hook_environment, umask from kallithea.lib.vcs import get_repo from kallithea.lib.vcs.backends.base import EmptyChangeset from kallithea.lib.vcs.exceptions import RepositoryError, VCSError @@ -711,7 +711,7 @@ fh, fn = tempfile.mkstemp(prefix=hook_file + '.tmp.') os.write(fh, tmpl.replace(b'_TMPL_', safe_bytes(kallithea.__version__))) os.close(fh) - os.chmod(fn, 0o755) + os.chmod(fn, 0o777 & ~umask) os.rename(fn, hook_file) except (OSError, IOError) as e: log.error('error writing hook %s: %s', hook_file, e)