aboutsummaryrefslogtreecommitdiff
path: root/local
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2019-12-14 06:50:04 -0800
committerRobin H. Johnson <robbat2@gentoo.org>2019-12-14 06:50:04 -0800
commitc904e96e783b4859d9053ba38a27210058a376c4 (patch)
tree011fba95116a92bf4590f62cda5818dd0e8c97f6 /local
parentRevert "Update git-gx86-tools" (diff)
downloadgithooks-c904e96e783b4859d9053ba38a27210058a376c4.tar.gz
githooks-c904e96e783b4859d9053ba38a27210058a376c4.tar.bz2
githooks-c904e96e783b4859d9053ba38a27210058a376c4.zip
pre-receive.gentoo-news: add zeros check
Work on any git checks that do not handle branches correctly. Bug: https://bugs.gentoo.org/show_bug.cgi?id=699894 Bug: https://bugs.gentoo.org/show_bug.cgi?id=699892 Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Diffstat (limited to 'local')
-rwxr-xr-xlocal/git.gentoo.org/pre-receive.gentoo-news7
1 files changed, 7 insertions, 0 deletions
diff --git a/local/git.gentoo.org/pre-receive.gentoo-news b/local/git.gentoo.org/pre-receive.gentoo-news
index c8cffee..a820507 100755
--- a/local/git.gentoo.org/pre-receive.gentoo-news
+++ b/local/git.gentoo.org/pre-receive.gentoo-news
@@ -17,6 +17,8 @@ PATH_REGEX = re.compile(r'''
. (?P<lang> [a-z]{2}) .txt (?: .asc )?
''', re.VERBOSE)
+# special git commit id
+ZEROS = '0000000000000000000000000000000000000000'
def main(prog, *argv):
if 'GIT_DIR' not in os.environ:
@@ -35,6 +37,11 @@ def main(prog, *argv):
return 1
def validate(oldrev, newrev, refname):
+ # Deletion of a branch means no work to do anyway.
+ # And git-diff will fail
+ if newrev == ZEROS:
+ return 0
+
proc = subprocess.Popen( \
['git', 'diff', \
'--name-only', '--diff-filter=A', \