Skip to content

Commit

Permalink
[gitlab] Fix ancestor computation for check_pkg_size (#32793)
Browse files Browse the repository at this point in the history
  • Loading branch information
KSerrania authored Jan 9, 2025
1 parent 50b30dd commit cb1b267
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tasks/libs/package/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def get_ancestor(ctx, package_sizes, on_main):
"""
ancestor = get_common_ancestor(ctx, "HEAD")
if not on_main and ancestor not in package_sizes:
return min(package_sizes, key=lambda x: package_sizes[x]['timestamp'])
return max(package_sizes, key=lambda x: package_sizes[x]['timestamp'])
return ancestor


Expand Down
2 changes: 1 addition & 1 deletion tasks/unit_tests/package_lib_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def test_found_on_dev(self):
@patch.dict('os.environ', {'CI_COMMIT_REF_NAME': 'puppet'})
def test_not_found_on_dev(self):
c = MockContext(run={'git merge-base HEAD origin/main': Result('grand_pa')})
self.assertEqual(get_ancestor(c, self.package_sizes, False), "grand_ma")
self.assertEqual(get_ancestor(c, self.package_sizes, False), "ma")

@patch.dict('os.environ', {'CI_COMMIT_REF_NAME': 'main'})
def test_on_main(self):
Expand Down

0 comments on commit cb1b267

Please sign in to comment.