╭ changed ────╮ │src/event.zig│ ╰─────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭─────────────────────────────────────╮ │72 comment: ?Comment, │ │73 }; │ │74 │ │75 +// who a commit is attributed to │ │76 +pub const CommitAuthor = struct {│ │77 + name: []const u8, │ │78 + email: []const u8, │ │79 +}; │ │80 + │ │81 pub const EventWithId = struct { │ │82 id: [event_id_size * 2]u8, │ │83 event: Event, │ ╰─────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────╮ │84 timestamp: u64 = 0, // not serialized, because it comes from the commit timestamp │ │79 - author_email: []const u8, // not serialized, because it goes in the commit author │ │85 + author: CommitAuthor, // not serialized, because it goes in the commit author line│ │86 │ │87 pub fn jsonStringify(self: EventWithId, jw: anytype) !void { │ │88 try jw.beginObject(); │ ╰──────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────╮ │107 return .{ │ │108 .id = json_event.id, │ │109 // unused when reading; the author lives in the commit│ │104 - .author_email = "", │ │110 + .author = .{ .name = "", .email = "" }, │ │111 .event = switch (json_event.kind) { │ │112 .user => .{ │ │113 .user = if (json_event.data) |value| │ ╰───────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │351 json.clearRetainingCapacity(); │ │352 try std.json.Stringify.value(event, .{}, &json.writer); │ │353 if (json.written().len > max_event_size) return error.EventTooLarge; │ │348 - const author = try std.fmt.allocPrint(allocator, "haxy <{s}>", .{event.author_email}); │ │354 + const author = try std.fmt.allocPrint(allocator, "{s} <{s}>", .{ event.author.name, event.author.email }); │ │355 defer allocator.free(author); │ │356 _ = try obj.writeCommit(repo_kind, repo_opts, state, io, allocator, .{ .author = author, .message = json.written(), .timestamp = event.timestamp, .parent_oids = parent_oids }, null, ref);│ │357 // later events parent on the ref's new tip │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────╮ │1234 try consume(.xit, admin_repo_opts, io, allocator, &repo, events_ref, &[_]EventWithId{.{│ │1235 .id = event_id_hex, │ │1236 .timestamp = @intCast(std.Io.Timestamp.now(io, .real).toSeconds()), │ │1231 - .author_email = owner.event.email, │ │1237 + .author = .{ .name = owner.event.name, .email = owner.event.email }, │ │1238 .event = .{ .repo = .{ │ │1239 .user_id = &owner_user_id, │ │1240 .name = repo_name, │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────╯