//! How a check-in shows in one-line listings: the short-hash width, the
//! first comment line, the `sym-` prefix and the hash order, shared by the
//! history verbs and the commands that print check-ins.
const std = @import("std");
/// Displayed prefix of the full artifact hash on a timeline line. Display only:
/// the total order keys on the FULL hash inside `checkinsByMtime`, so a display
/// collision never perturbs ordering.
pub const timeline_hash_display = 12;
/// The first line of a check-in comment (up to, excluding, the first LF), so a
/// multi-line comment never injects a newline into the one-line-per-check-in
/// listing (B-timeline-6). A comment with no LF is returned whole.
pub fn firstCommentLine(comment: []const u8) []const u8 {
const nl = std.mem.indexOfScalar(u8, comment, '\n') orelse return comment;
return comment[0..nl];
}
/// The reserved 'sym-' prefix (repo-state ยง2): a symbolic name is stored with
/// it and surfaced with it stripped.
pub const sym_prefix = "sym-";
/// Ascending raw-byte order over two artifact IDs, so the merge-parent lines
/// print in a deterministic order (IDs are unique per check-in).
pub fn lessByHash(_: void, a: []const u8, b: []const u8) bool {
return std.mem.order(u8, a, b) == .lt;
}