krz/hutch

an ios client for sourcehut

clone: git clone https://gitbay.org/krz/hutch.git

v3.8.2: Hutch/Models/CommitSummary.swift · raw

 1import Foundation
 2
 3/// Lightweight commit model for list views. Matches the subset of fields
 4/// returned by the repository log query.
 5struct CommitSummary: Codable, Sendable, Identifiable, Hashable {
 6    let id: String
 7    let shortId: String
 8    let author: CommitAuthor
 9    let message: String
10
11    /// First line of the commit message.
12    var title: String {
13        message.prefix(while: { $0 != "\n" }).trimmingCharacters(in: .whitespaces)
14    }
15}
16
17/// A compact author representation used in commit list responses.
18struct CommitAuthor: Codable, Sendable, Hashable {
19    let name: String
20    let email: String?
21    let time: Date
22}