mirror of
https://github.com/zulip/zulip.git
synced 2025-10-29 19:13:53 +00:00
git: Fix nondeterministic ordering of commit authors.
This should fix the nondeterministic test failures introduced by
e7455e276b.
This commit is contained in:
@@ -190,7 +190,9 @@ def get_all_committers(commits_data):
|
||||
for commit in commits_data:
|
||||
committers[commit['name']] += 1
|
||||
|
||||
committers_items = sorted(list(committers.items()), key=lambda item: item[1], reverse=True) # type: List[Tuple[str, int]]
|
||||
# Sort by commit count, breaking ties alphabetically.
|
||||
committers_items = sorted(list(committers.items()),
|
||||
key=lambda item: (-item[1], item[0])) # type: List[Tuple[str, int]]
|
||||
committers_values = [c_i[1] for c_i in committers_items] # type: List[int]
|
||||
|
||||
if len(committers) > PUSH_COMMITTERS_LIMIT_INFO:
|
||||
|
||||
@@ -41,7 +41,7 @@ class GitlabHookTests(WebhookTestCase):
|
||||
# type: () -> None
|
||||
expected_subject = u"my-awesome-project / tomek"
|
||||
commit_info = u"* b ([eb6ae1e](https://gitlab.com/tomaszkolek0/my-awesome-project/commit/eb6ae1e591e0819dc5bf187c6bfe18ec065a80e9))\n"
|
||||
expected_message = u"Tomasz Kolek [pushed](https://gitlab.com/tomaszkolek0/my-awesome-project/compare/5fcdd5551fc3085df79bece2c32b1400802ac407...eb6ae1e591e0819dc5bf187c6bfe18ec065a80e9) 7 commits to branch tomek. Commits by Ben(3), baxterthehacker(2), Tomasz Kolek(1) and others(1)\n\n{}* b ([eb6ae1e](https://gitlab.com/tomaszkolek0/my-awesome-project/commit/eb6ae1e591e0819dc5bf187c6bfe18ec065a80e9))".format(commit_info * 6)
|
||||
expected_message = u"Tomasz Kolek [pushed](https://gitlab.com/tomaszkolek0/my-awesome-project/compare/5fcdd5551fc3085df79bece2c32b1400802ac407...eb6ae1e591e0819dc5bf187c6bfe18ec065a80e9) 7 commits to branch tomek. Commits by Ben(3), baxterthehacker(2), James(1) and others(1)\n\n{}* b ([eb6ae1e](https://gitlab.com/tomaszkolek0/my-awesome-project/commit/eb6ae1e591e0819dc5bf187c6bfe18ec065a80e9))".format(commit_info * 6)
|
||||
self.send_and_test_stream_message('push_multiple_committers_with_others', expected_subject, expected_message, HTTP_X_GITLAB_EVENT="Push Hook")
|
||||
|
||||
def test_push_commits_more_than_limit_event_message(self):
|
||||
|
||||
Reference in New Issue
Block a user