Good Morning Everyone, While testing something in dist-git two days ago, we found out that there is a piece of code missing to the alternativearch git hook. Here is the error we saw: Counting objects: 3, done. Delta compression using up to 4 threads. Compressing objects: 100% (3/3), done. Writing objects: 100% (3/3), 384 bytes | 384.00 KiB/s, done. Total 3 (delta 2), reused 0 (delta 0) remote: sh: /usr/lib/python2.7/site-packages/pagure/hooks/files/fedmsg_hook.py: No such file or directory remote: Emitting a message to the fedmsg bus. remote: * Publishing information for 1 commits remote: Traceback (most recent call last): remote: File "/usr/share/git-core/post-receive-alternativearch", line 206, in <module> remote: run_as_post_receive_hook() remote: File "/usr/share/git-core/post-receive-alternativearch", line 163, in run_as_post_receive_hook remote: new_commits_list = get_revs_between(oldrev, newrev, abspath, refname) remote: File "/usr/share/git-core/post-receive-alternativearch", line 96, in get_revs_between remote: head = get_default_branch(abspath) remote: NameError: global name 'get_default_branch' is not defined remote: Sending to redis to send commit notification emails remote: * Publishing information for 1 commits remote: remote: Create a pull-request for f27 remote: https://src.stg.fedoraproject.org/rpms/guake/diff/master..f27 remote: To ssh://pkgs.stg.fedoraproject.org/rpms/guake * [new branch] f27 -> f27 And here is the patch I would like to apply to fix it: diff --git a/roles/git/hooks/files/post-receive-alternativearch b/roles/git/hooks/files/post-receive-alternativearch index 7bc4a9a6a..8d93137e4 100755 --- a/roles/git/hooks/files/post-receive-alternativearch +++ b/roles/git/hooks/files/post-receive-alternativearch @@ -100,6 +100,15 @@ def get_revs_between(oldrev, newrev, abspath, refname): return read_git_lines(cmd, abspath) +def get_default_branch(abspath): + """ Return the default branch of a repo. """ + cmd = ['rev-parse', '--abbrev-ref', 'HEAD'] + out = read_git_lines(cmd, abspath) + if out: + return out[0] + else: + return 'master' + def send_email(text, subject, to_mail): # pragma: no cover ''' Send an email with the specified information. Thoughts? Pierre
Attachment:
signature.asc
Description: PGP signature
_______________________________________________ infrastructure mailing list -- infrastructure@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe send an email to infrastructure-leave@xxxxxxxxxxxxxxxxxxxxxxx