diff --git a/git.zig b/git.zig index 69ae4e7b3612601c5d37075d2062a291d7c91a5e..eaa0c991d1b0d595436e04b9ce6427886d94f654 100644 --- a/git.zig +++ b/git.zig @@ -7,10 +7,38 @@ const tracer = @import("tracer"); // 40 is length of sha1 hash pub const Id = *const [40]u8; -pub const TreeId = struct { id: Id }; -pub const CommitId = struct { id: Id }; -pub const BlobId = struct { id: Id }; -pub const TagId = struct { id: Id }; + +pub const TreeId = struct { + id: Id, + + pub fn eql(self: TreeId, other: TreeId) bool { + return std.mem.eql(u8, self.id, other.id); + } +}; + +pub const CommitId = struct { + id: Id, + + pub fn eql(self: CommitId, other: CommitId) bool { + return std.mem.eql(u8, self.id, other.id); + } +}; + +pub const BlobId = struct { + id: Id, + + pub fn eql(self: BlobId, other: BlobId) bool { + return std.mem.eql(u8, self.id, other.id); + } +}; + +pub const TagId = struct { + id: Id, + + pub fn eql(self: TagId, other: TagId) bool { + return std.mem.eql(u8, self.id, other.id); + } +}; pub fn version(alloc: std.mem.Allocator) !string { const result = try std.process.Child.run(.{