diff options
| author | Ralph Bean <rbean@redhat.com> | 2015-03-12 23:15:56 +0000 |
|---|---|---|
| committer | Ralph Bean <rbean@redhat.com> | 2015-03-12 23:15:56 +0000 |
| commit | 6f3ac61b969b9441f7756ea1c4a22675704017e4 (patch) | |
| tree | 2558d0ff683d93dc1ee25fc5af1c0b8f55de0189 /roles/git | |
| parent | 521db28636a75c4973521d4a38f9f11ad38a01e8 (diff) | |
| download | ansible-6f3ac61b969b9441f7756ea1c4a22675704017e4.tar.gz ansible-6f3ac61b969b9441f7756ea1c4a22675704017e4.tar.xz ansible-6f3ac61b969b9441f7756ea1c4a22675704017e4.zip | |
No more inifinite loops, please.
See https://github.com/fedora-infra/fedmsg/pull/326
Diffstat (limited to 'roles/git')
| -rw-r--r-- | roles/git/hooks/files/post-receive-fedmsg | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/roles/git/hooks/files/post-receive-fedmsg b/roles/git/hooks/files/post-receive-fedmsg index ae618882c..deb0ae1f5 100644 --- a/roles/git/hooks/files/post-receive-fedmsg +++ b/roles/git/hooks/files/post-receive-fedmsg @@ -26,19 +26,15 @@ config['active'] = True config['endpoints']['relay_inbound'] = config['relay_inbound'] fedmsg.init(name='relay_inbound', cert_prefix='scm', **config) -def revs_between(head, ancestors): - """ Yield revisions between HEAD and any of the ancestors. """ +def revs_between(head, base): + """ Yield revisions between HEAD and BASE. """ - # For each of my parents - for parent in head.parents: - # If it is not one of the known ancestors - if not parent.id in ancestors: - # Then yield all of its history, meeting the same conditions - for rev in revs_between(parent, ancestors): - yield rev - - if not head.id in ancestors: - yield head.id + # XXX REALLY, just yield head. + # We used to try to navigate the git history and return all the commits in + # between, but we got into infinite loops more than once because git. + # We could shell out to 'git rev-list head...base', but I'm just not ready + # to do that yet. + yield head.id def build_stats(commit): @@ -81,8 +77,7 @@ for line in lines: try: base = repo.revparse_single(base) - ancestors = [commit.id for commit in repo.walk(base.id)] - revs = revs_between(head, ancestors) + revs = revs_between(head, base) except KeyError: revs = [head.id] |
