##// END OF EJS Templates
fix(hooks): improve the code that manages hooks dir and files to be more prone to permissions issues
super-admin -
r1179:4e9d64b6 default
parent child Browse files
Show More
@@ -41,14 +41,20 b' def install_git_hooks(repo_path, bare, e'
41 Creates a RhodeCode hook inside a git repository
41 Creates a RhodeCode hook inside a git repository
42
42
43 :param repo_path: path to repository
43 :param repo_path: path to repository
44 :param bare: defines if repository is considered a bare git repo
44 :param executable: binary executable to put in the hooks
45 :param executable: binary executable to put in the hooks
45 :param force_create: Create even if same name hook exists
46 :param force_create: Creates even if the same name hook exists
46 """
47 """
47 executable = executable or sys.executable
48 executable = executable or sys.executable
48 hooks_path = get_git_hooks_path(repo_path, bare)
49 hooks_path = get_git_hooks_path(repo_path, bare)
49
50
50 if not os.path.isdir(hooks_path):
51 # we always call it to ensure dir exists and it has a proper mode
52 if not os.path.exists(hooks_path):
53 # If it doesn't exist, create a new directory with the specified mode
51 os.makedirs(hooks_path, mode=0o777, exist_ok=True)
54 os.makedirs(hooks_path, mode=0o777, exist_ok=True)
55 else:
56 # If it exists, change the directory's mode to the specified mode
57 os.chmod(hooks_path, mode=0o777)
52
58
53 tmpl_post = pkg_resources.resource_string(
59 tmpl_post = pkg_resources.resource_string(
54 'vcsserver', '/'.join(
60 'vcsserver', '/'.join(
General Comments 0
You need to be logged in to leave comments. Login now