mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-27 01:33:04 +00:00
build: pre-push refinement
This commit is contained in:
parent
4a824dfdbe
commit
3f4392fe15
2 changed files with 6 additions and 5 deletions
|
@ -10,6 +10,7 @@
|
||||||
# Linux, Windows and MacOS)
|
# Linux, Windows and MacOS)
|
||||||
|
|
||||||
# #!/bin/sh
|
# #!/bin/sh
|
||||||
|
# echo 'execute .githooks/pre-push.py' >> .githooks/hooks.log
|
||||||
# python3 .githooks/pre-push.py
|
# python3 .githooks/pre-push.py
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
|
@ -28,13 +29,12 @@ import re
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
local_branch = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD'], universal_newlines=True).strip()
|
local_branch = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD'], universal_newlines=True).strip()
|
||||||
wip_prefix = "^#\d+(?:\b.*)$"
|
wip_prefix = '^#\\d+(?:\\b.*)$'
|
||||||
message = 'The branch {local_branch} can not be pushed as it starts with a '#' which marks it as work in progress'
|
|
||||||
|
|
||||||
if re.match(wip_prefix, local_branch):
|
if re.match(wip_prefix, local_branch):
|
||||||
print(message)
|
print(f'The branch {local_branch} can not be pushed as it starts with a "#" which marks it as work in progress', file=open(".githooks/hooks.log", "a"))
|
||||||
|
print(f'The branch {local_branch} can not be pushed as it starts with a "#" which marks it as work in progress')
|
||||||
exit(1)
|
exit(1)
|
||||||
|
print(f'Pushing branch {local_branch}', file=open(".githooks/hooks.log", "a"))
|
||||||
exit(0)
|
exit(0)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,4 +1,5 @@
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
.githooks/hooks.log
|
||||||
.hugo_build.lock
|
.hugo_build.lock
|
||||||
exampleSite/public*
|
exampleSite/public*
|
||||||
exampleSite/hugo*.exe
|
exampleSite/hugo*.exe
|
||||||
|
|
Loading…
Reference in a new issue