aboutsummaryrefslogtreecommitdiff
path: root/local
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2019-12-14 23:18:37 -0800
committerRobin H. Johnson <robbat2@gentoo.org>2019-12-14 23:18:37 -0800
commit2c4d9ebe86288d742aab30198e4ecfe8dd5d61b2 (patch)
tree4b7b683387204dcfd8f9acf9cf5fd868a397c86a /local
parentpre-receive.gentoo-news: fix bytes encoding (diff)
downloadgithooks-2c4d9ebe86288d742aab30198e4ecfe8dd5d61b2.tar.gz
githooks-2c4d9ebe86288d742aab30198e4ecfe8dd5d61b2.tar.bz2
githooks-2c4d9ebe86288d742aab30198e4ecfe8dd5d61b2.zip
pre-receive.gentoo-news: merge-base for new tag/branchgithooks-20191215T071909Z
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Diffstat (limited to 'local')
-rwxr-xr-xlocal/git.gentoo.org/pre-receive.gentoo-news12
1 files changed, 12 insertions, 0 deletions
diff --git a/local/git.gentoo.org/pre-receive.gentoo-news b/local/git.gentoo.org/pre-receive.gentoo-news
index 2285310..3690d31 100755
--- a/local/git.gentoo.org/pre-receive.gentoo-news
+++ b/local/git.gentoo.org/pre-receive.gentoo-news
@@ -50,6 +50,18 @@ def validate(oldrev, newrev, refname):
if newrev == ZEROS:
return 0
+ # New branch or tag, find where it forked from master
+ if oldrev == ZEROS:
+ proc = subprocess.Popen( \
+ ['git', 'merge-base', \
+ 'refs/heads/master', newrev],
+ stdout=subprocess.PIPE)
+ merge_base = proc.communicate()[0].rstrip()
+ if isinstance(merge_base, bytes):
+ merge_base = merge_base.decode()
+ if len(merge_base) > 0:
+ oldrev = merge_base
+
proc = subprocess.Popen( \
['git', 'diff', \
'--name-only', '--diff-filter=A', \