0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-28 02:14:06 -05:00
forgejo/modules
Giteabot 272ae03341
Make gogit Repository.GetBranchNames consistent (#28348) (#28386)
Backport #28348 by @AdamMajer

nogogit GetBranchNames() lists branches sorted in reverse commit date
order. On the other hand the gogit implementation doesn't apply any
ordering resulting in unpredictable behaviour. In my case, the unit
tests requiring particular order fail

    repo_branch_test.go:24:
                Error Trace:
               ./gitea/modules/git/repo_branch_test.go:24
                Error:          elements differ

                                extra elements in list A:
                                ([]interface {}) (len=1) {
                                 (string) (len=6) "master"
                                }

                                extra elements in list B:
                                ([]interface {}) (len=1) {
                                 (string) (len=7) "branch1"
                                }

                                listA:
                                ([]string) (len=2) {
                                 (string) (len=6) "master",
                                 (string) (len=7) "branch2"
                                }

                                listB:
                                ([]string) (len=2) {
                                 (string) (len=7) "branch1",
                                 (string) (len=7) "branch2"
                                }
                Test:           TestRepository_GetBranches

To fix this, we sort branches based on their commit date in gogit
implementation.

Fixes: #28318

Co-authored-by: Adam Majer <amajer@suse.de>
2023-12-07 13:03:27 -05:00
..
actions
activitypub
analyze
assetfs
auth
avatar
base
cache
charset
container
context Add guide page to actions when there's no workflows (#28145) (#28153) 2023-11-22 02:29:54 +00:00
contexttest
csv
doctor Fix delete-orphaned-repos (#28200) (#28202) 2023-11-24 14:54:14 -05:00
emoji
eventsource
generate
git Make gogit Repository.GetBranchNames consistent (#28348) (#28386) 2023-12-07 13:03:27 -05:00
gitgraph
graceful
hcaptcha
highlight
hostmatcher
html
httpcache
httplib
indexer Meilisearch: require all query terms to be matched (#28293) (#28296) 2023-11-29 09:38:04 -06:00
issue/template
json
label
lfs
log
markup Render email addresses as such if followed by punctuation (#27987) (#27992) 2023-11-11 13:26:18 +08:00
mcaptcha
metrics
migration
nosql
options
packages
paginator
pprof
private
process
proxy
proxyprotocol
public
queue
recaptcha
references
regexplru
repository Ignore "non-existing" errors when getDirectorySize calculates the size (#28276) (#28285) 2023-11-30 16:39:16 +00:00
secret
session
setting Fix incorrect default value of [attachment].MAX_SIZE (#28373) (#28376) 2023-12-06 19:32:23 +00:00
sitemap
ssh
storage
structs
svg
sync
system
templates
test
testlogger
timeutil
translation
turnstile
typesniffer
updatechecker
upload
uri
user
util
validation
web Make CORS work for oauth2 handlers (#28184) (#28185) 2023-11-23 22:27:00 +08:00
webhook