From c904e96e783b4859d9053ba38a27210058a376c4 Mon Sep 17 00:00:00 2001 From: "Robin H. Johnson" Date: Sat, 14 Dec 2019 06:50:04 -0800 Subject: 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 --- local/git.gentoo.org/pre-receive.gentoo-news | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'local/git.gentoo.org') 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 [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', \ -- cgit v1.2.3-65-gdbad