gitea
gitea copied to clipboard
Optimize branch protection rule loading
currently we only sort branch protection rules by creation time and type.
this change the order for non glob names as it make no difference to be alphabetical.
Sponsored by Kithara Software GmbH
the followup work will make glob rules order by user define priority ... so you dont have to delete and recreate rules just to have the correct order ...
I suggest to not handle the non-glob rules differently. I can imagine a order of rules where a non-glob rule might should kick in between two glob rules. Also from a user perspective it is probably confusing why the one rule is added "in the middle" while the other is added to the end.
If you handle both type the same the user interface becomes easier understandable.
I would like to priority rather than this one.
@lunny all changes related sorting are moved out and will be done in https://github.com/go-gitea/gitea/pull/32286
this is now just a pull to refactor and add more test coverage
before if it was nonglob each load would try to glob it and the check that is not glob ... now we only do that once and no future loading will trigger it
@lunny updated pull description ... I missed that one sorry