mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-04 13:50:39 +00:00
Sort branches and tags by date descending (#21136)
This fixes #5709 and #17316 by changing the order of listed branches and tags to show the ones with latest commits atop. It's achieved with changing underlying "show-ref" git command with "for-each-ref" as suggested in https://stackoverflow.com/a/5188364 Also, it's passing format string so the output matches "show-ref" command output. close #5709 close #17316
This commit is contained in:
parent
5933f04094
commit
e07d089be0
3 changed files with 8 additions and 8 deletions
|
@ -22,14 +22,14 @@ func TestRepository_GetBranches(t *testing.T) {
|
|||
assert.NoError(t, err)
|
||||
assert.Len(t, branches, 2)
|
||||
assert.EqualValues(t, 3, countAll)
|
||||
assert.ElementsMatch(t, []string{"branch1", "branch2"}, branches)
|
||||
assert.ElementsMatch(t, []string{"master", "branch2"}, branches)
|
||||
|
||||
branches, countAll, err = bareRepo1.GetBranchNames(0, 0)
|
||||
|
||||
assert.NoError(t, err)
|
||||
assert.Len(t, branches, 3)
|
||||
assert.EqualValues(t, 3, countAll)
|
||||
assert.ElementsMatch(t, []string{"branch1", "branch2", "master"}, branches)
|
||||
assert.ElementsMatch(t, []string{"master", "branch2", "branch1"}, branches)
|
||||
|
||||
branches, countAll, err = bareRepo1.GetBranchNames(5, 1)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue