Monorepo for Tangled tangled.org

knotserver: fix sort order of tags #610

merged opened by oppi.li targeting master from push-okxlrwoolxpr

the output produced by for-each-rev is lexicographic.

Signed-off-by: oppiliappan me@oppi.li

Labels

None yet.

assignee

None yet.

Participants 2
AT URI
at://did:plc:qfpnj4og54vl56wngdriaxug/sh.tangled.repo.pull/3lzsyi6pnbj22
+10 -1
Diff #0
+10 -1
knotserver/git/tag.go
··· 94 94 tags = append(tags, tag) 95 95 } 96 96 97 - slices.Reverse(tags) 97 + slices.SortFunc(tags, func(a, b object.Tag) int { 98 + if a.Tagger.When.After(b.Tagger.When) { 99 + return -1 100 + } 101 + if b.Tagger.When.After(a.Tagger.When) { 102 + return 1 103 + } 104 + return 0 105 + }) 106 + 98 107 return tags, nil 99 108 }

History

2 rounds 2 comments
sign up or login to add to the discussion
1 commit
expand
knotserver: fix sort order of tags
expand 0 comments
pull request successfully merged
oppi.li submitted #0
1 commit
expand
knotserver: fix sort order of tags
expand 2 comments

Have you considered just passing --sort=-creatordate to git for-each-ref?

ah of course! that would be much nicer. thanks for the suggestion!