diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2019-12-14 06:50:04 -0800 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2019-12-14 06:50:04 -0800 |
commit | c904e96e783b4859d9053ba38a27210058a376c4 (patch) | |
tree | 011fba95116a92bf4590f62cda5818dd0e8c97f6 | |
parent | Revert "Update git-gx86-tools" (diff) | |
download | githooks-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>
-rwxr-xr-x | local/git.gentoo.org/pre-receive.gentoo-news | 7 |
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', \ |