diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2019-12-14 23:18:37 -0800 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2019-12-14 23:18:37 -0800 |
commit | 2c4d9ebe86288d742aab30198e4ecfe8dd5d61b2 (patch) | |
tree | 4b7b683387204dcfd8f9acf9cf5fd868a397c86a /local | |
parent | pre-receive.gentoo-news: fix bytes encoding (diff) | |
download | githooks-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-x | local/git.gentoo.org/pre-receive.gentoo-news | 12 |
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', \ |