| ... | @@ -7,10 +7,38 @@ const tracer = @import("tracer"); | ... | @@ -7,10 +7,38 @@ const tracer = @import("tracer"); |
| 7 | | 7 | |
| 8 | // 40 is length of sha1 hash | 8 | // 40 is length of sha1 hash |
| 9 | pub const Id = *const [40]u8; | 9 | pub const Id = *const [40]u8; |
| 10 | pub const TreeId = struct { id: Id }; | 10 | |
| 11 | pub const CommitId = struct { id: Id }; | 11 | pub const TreeId = struct { |
| 12 | pub const BlobId = struct { id: Id }; | 12 | id: Id, |
| 13 | pub const TagId = struct { id: Id }; | 13 | |
| | 14 | pub fn eql(self: TreeId, other: TreeId) bool { |
| | 15 | return std.mem.eql(u8, self.id, other.id); |
| | 16 | } |
| | 17 | }; |
| | 18 | |
| | 19 | pub const CommitId = struct { |
| | 20 | id: Id, |
| | 21 | |
| | 22 | pub fn eql(self: CommitId, other: CommitId) bool { |
| | 23 | return std.mem.eql(u8, self.id, other.id); |
| | 24 | } |
| | 25 | }; |
| | 26 | |
| | 27 | pub const BlobId = struct { |
| | 28 | id: Id, |
| | 29 | |
| | 30 | pub fn eql(self: BlobId, other: BlobId) bool { |
| | 31 | return std.mem.eql(u8, self.id, other.id); |
| | 32 | } |
| | 33 | }; |
| | 34 | |
| | 35 | pub const TagId = struct { |
| | 36 | id: Id, |
| | 37 | |
| | 38 | pub fn eql(self: TagId, other: TagId) bool { |
| | 39 | return std.mem.eql(u8, self.id, other.id); |
| | 40 | } |
| | 41 | }; |
| 14 | | 42 | |
| 15 | pub fn version(alloc: std.mem.Allocator) !string { | 43 | pub fn version(alloc: std.mem.Allocator) !string { |
| 16 | const result = try std.process.Child.run(.{ | 44 | const result = try std.process.Child.run(.{ |