Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion gitosis/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from cStringIO import StringIO
from ConfigParser import RawConfigParser

from stat import ST_MODE
from gitosis import repository
from gitosis import run_hook
from gitosis import ssh
Expand Down Expand Up @@ -78,7 +79,9 @@ def init_admin_repository(
path=git_dir,
)
hook = os.path.join(git_dir, 'hooks', 'post-update')
os.chmod(hook, 0755)
mode = os.stat(hook)[ST_MODE]
if not (mode & 0755) == 0755:
os.chmod(hook, 0755)
if not repository.has_initial_commit(git_dir):
log.info('Making initial commit...')
# ConfigParser does not guarantee order, so jump through hoops
Expand Down
13 changes: 8 additions & 5 deletions gitosis/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import subprocess
import sys

from stat import ST_MODE
from pkg_resources import resource_filename
from gitosis import util

Expand Down Expand Up @@ -42,7 +43,7 @@ def init(
template = resource_filename('gitosis.templates', 'default')


util.mkdir(path, 0750)
util.mkdir(path, 0755)
args = [
_git,
'--git-dir=.',
Expand Down Expand Up @@ -71,9 +72,11 @@ def init(
if not os.path.exists(hooks_dir):
raise
for hook in hooks:
os.chmod(
os.path.join(hooks_dir, hook),
0755)
mode = os.stat(os.path.join(hooks_dir, hook))[ST_MODE]
if not (mode & 0755) == 0755:
os.chmod(
os.path.join(hooks_dir, hook),
0755)


class GitFastImportError(GitError):
Expand Down Expand Up @@ -234,4 +237,4 @@ def mirror(git_dir, remote):
close_fds=True
)
if returncode != 0:
raise GitPushMirrorException('exit status %d' % returncode)
raise GitPushMirrorException('exit status %d' % returncode)
Empty file modified gitosis/templates/default/hooks/post-receive
100644 → 100755
Empty file.