RefService.FindDefaultBranchName: filter out non existing target
It turns out that Gitaly returns an empty response on an empty repository, whatever the value stored as default branch might be. In case the default branch points to a branch that does not exist, it returns the first branch it can find. This latter case cannot happen with the state maintainer provided by py-heptapod. This can be important for various mechanisms to actually set the default branch. We're simply returning an empty response if the default branch is set but its target does not exist. This amounts to the same in all current scenarios. Later on we could return the first GitLab branch if that becomes useful.
Showing
- hgitaly/service/ref.py 1 addition, 1 deletionhgitaly/service/ref.py
- hgitaly/service/tests/test_default_branch.py 7 additions, 0 deletionshgitaly/service/tests/test_default_branch.py
- hgitaly/servicer.py 1 addition, 0 deletionshgitaly/servicer.py
- rust/rhgitaly/src/gitlab/revision.rs 26 additions, 14 deletionsrust/rhgitaly/src/gitlab/revision.rs
- rust/rhgitaly/src/service/ref.rs 7 additions, 5 deletionsrust/rhgitaly/src/service/ref.rs
- tests_with_gitaly/test_ref.py 37 additions, 0 deletionstests_with_gitaly/test_ref.py
Loading
Please register or sign in to comment