-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpre-push
executable file
·27 lines (20 loc) · 960 Bytes
/
pre-push
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env python3
import subprocess
remotes = (remote.decode('utf-8')
for remote in subprocess.check_output(('/usr/bin/git',
'remote')).split(b'\n'))
for remote in remotes:
if not remote:
continue
subprocess.call(('/usr/bin/git', 'fetch', remote))
# TODO(mcsalgado): yeah, this is very roundabout...
# doing those fetch and merge notes before pushing...
subprocess.call(('/usr/bin/git', 'fetch', remote,
'refs/notes/commits:'
'refs/notes/{}/commits2'.format(remote)))
subprocess.call(('/usr/bin/git', 'notes', 'merge', '-v',
'{}/commits2'.format(remote)))
# NOTE(mcsalgado): the --no-verify option here is important so we don't call
# this pre-push hook again for this one push
subprocess.call(('/usr/bin/git', 'push', '--no-verify', remote,
'refs/notes/*'))