| 245 | } |
| 246 | |
| 247 | func gitRequests(scratch string, requests []loggedRequest) ([]loggedRequest, error) { |
| 248 | ssh, err := readJSONL[loggedRequest](filepath.Join(scratch, "git-ssh.jsonl")) |
| 249 | if err != nil { |
| 250 | return nil, err |
| 251 | } |
| 252 | positions := map[string]int{} |
| 253 | for _, entry := range ssh { |
| 254 | if entry.Git != nil && entry.Git.ID != "" { |
| 255 | if index, ok := positions[entry.Git.ID]; ok { |
| 256 | requests[index] = entry |
| 257 | continue |
| 258 | } |
| 259 | positions[entry.Git.ID] = len(requests) |
| 260 | } |
| 261 | requests = append(requests, entry) |
| 262 | } |
| 263 | slices.SortStableFunc(requests, func(a, b loggedRequest) int { return a.Time.Compare(b.Time) }) |
| 264 | for i := range requests { |
| 265 | requests[i].Seq = i + 1 |
| 266 | } |
| 267 | return requests, nil |
| 268 | } |