| ... | @@ -1,5 +1,6 @@ | ... | @@ -1,5 +1,6 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | const string = []const u8; | 2 | const string = []const u8; |
| | 3 | const top = @This(); |
| 3 | | 4 | |
| 4 | // 40 is length of sha1 hash | 5 | // 40 is length of sha1 hash |
| 5 | pub const Id = *const [40]u8; | 6 | pub const Id = *const [40]u8; |
| ... | @@ -147,6 +148,12 @@ pub const Tree = struct { | ... | @@ -147,6 +148,12 @@ pub const Tree = struct { |
| 147 | commit: CommitId, | 148 | commit: CommitId, |
| 148 | | 149 | |
| 149 | pub const Tag = std.meta.Tag(@This()); | 150 | pub const Tag = std.meta.Tag(@This()); |
| | 151 | |
| | 152 | pub fn erase(self: @This()) top.Id { |
| | 153 | return switch (self) { |
| | 154 | inline else => |v| v.id, |
| | 155 | }; |
| | 156 | } |
| 150 | }; | 157 | }; |
| 151 | | 158 | |
| 152 | pub const Mode = struct { | 159 | pub const Mode = struct { |