This commit is contained in:
Ian Gulliver
2026-10-20 22:32:24 -07:00
parent 3560327dd4
commit ae6e9e3f77
2 changed files with 15 additions and 18 deletions
+2 -6
View File
@@ -3,7 +3,6 @@ package agents
import (
"context"
"fmt"
"sort"
"strings"
"time"
@@ -16,7 +15,7 @@ const signTimeout = 2 * time.Minute
func (m *Manager) signer(ctx context.Context, user api.User) func(payload []byte) ([]byte, error) {
return func(payload []byte) ([]byte, error) {
mine := []clients.Client{}
for _, c := range m.clients.List() {
for _, c := range m.recentClients() {
if c.Login == user.Login {
mine = append(mine, c)
}
@@ -24,10 +23,7 @@ func (m *Manager) signer(ctx context.Context, user api.User) func(payload []byte
if len(mine) == 0 {
return nil, fmt.Errorf("commits are signed on %s's Mac, and none of theirs is connected", user.Login)
}
sort.SliceStable(mine, func(i, j int) bool {
a, b := mine[i].LastActionAt, mine[j].LastActionAt
return a != nil && (b == nil || a.After(*b))
})
client := mine[0]
ident := fmt.Sprintf("%s <%s>", user.GitName, user.GitEmail)