mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Use custom templates for Git repositories
Do not waste disk space by copying dozens of unneeded sample hooks. Use a custom template directory that only includes the git-update hook. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
This commit is contained in:
parent
cb661cd971
commit
4dbd562b8e
5 changed files with 42 additions and 10 deletions
29
scripts/git-integration/gen-templates.py
Executable file
29
scripts/git-integration/gen-templates.py
Executable file
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import configparser
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
|
||||
config = configparser.RawConfigParser()
|
||||
config.read(os.path.dirname(os.path.realpath(__file__)) + "/../../conf/config")
|
||||
|
||||
template_path = config.get('serve', 'template-path')
|
||||
git_update_hook = config.get('serve', 'git-update-hook')
|
||||
|
||||
def die(msg):
|
||||
sys.stderr.write("%s\n" % (msg))
|
||||
exit(1)
|
||||
|
||||
if os.path.exists(template_path):
|
||||
shutil.rmtree(template_path)
|
||||
|
||||
os.mkdir(template_path)
|
||||
os.chdir(template_path)
|
||||
os.mkdir("branches")
|
||||
os.mkdir("hooks")
|
||||
os.mkdir("info")
|
||||
os.symlink(git_update_hook, template_path + 'hooks/update')
|
||||
|
||||
with open("description", 'w') as f:
|
||||
f.write("Unnamed repository; push to update the description.\n")
|
Loading…
Add table
Add a link
Reference in a new issue