Skip to content
Snippets Groups Projects
Commit 0ccdc683 authored by Georges Racinet's avatar Georges Racinet
Browse files

branch.sorted_gitlab_branches_as_refs: fixed bug with after param

The `after` parameter was always interpreted as if `sort_by` was
`FULL_REF_NAME`.
parent 73e9ff17
1 merge request!101RefService.ListRefs: initial implementation
......@@ -323,9 +323,10 @@
ref_targets = sorted(iter_gitlab_branches_as_refs(repo, deref=inner_deref),
key=sort_key)
if after is not None:
# TODO BUG this works for lexicographic sorting only.
ref_targets = (ref_target for ref_target in ref_targets
if ref_target[0] > after)
ref_targets = iter(ref_targets)
for ref, _ in ref_targets:
if ref == after:
break
if inner_deref and not deref:
ref_targets = ((ref, target.hex().decode('ascii'))
......
......@@ -98,6 +98,14 @@
(default_branch_ref, base),
]
assert list(sorted_gitlab_branches_as_refs(
repo,
sort_by=BranchSortBy.UPDATED_ASC,
after=default_branch_ref,
)) == [
(another_branch_ref, another),
]
def test_named_branch_multiple_heads(tmpdir):
wrapper = make_repo(tmpdir)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment