| ... | ... | @@ -164,7 +164,14 @@ pub fn parseCommit(alloc: std.mem.Allocator, commitfile: string) !Commit { |
| 164 | 164 | defer t.end(); |
| 165 | 165 | |
| 166 | 166 | var iter = std.mem.splitScalar(u8, commitfile, '\n'); |
| 167 | | var result: Commit = undefined; |
| 167 | var result: Commit = .{ |
| 168 | .raw = commitfile, |
| 169 | .tree = undefined, |
| 170 | .parents = undefined, |
| 171 | .author = undefined, |
| 172 | .committer = undefined, |
| 173 | .message = undefined, |
| 174 | }; |
| 168 | 175 | var parents = std.array_list.Managed(CommitId).init(alloc); |
| 169 | 176 | errdefer parents.deinit(); |
| 170 | 177 | while (true) { |
| ... | ... | @@ -570,8 +577,13 @@ pub fn parseTag(tagfile: string) !Tag { |
| 570 | 577 | defer t.end(); |
| 571 | 578 | |
| 572 | 579 | var iter = std.mem.splitScalar(u8, tagfile, '\n'); |
| 573 | | var result: Tag = undefined; |
| 574 | | result.tagger = null; |
| 580 | var result: Tag = .{ |
| 581 | .raw = tagfile, |
| 582 | .object = undefined, |
| 583 | .type = undefined, |
| 584 | .tagger = null, |
| 585 | .message = undefined, |
| 586 | }; |
| 575 | 587 | const object = extras.trimPrefixEnsure(iter.next().?, "object ").?; |
| 576 | 588 | std.debug.assert(object.len == 40); |
| 577 | 589 | result.object = object[0..40]; |
| ... | ... | @@ -1110,7 +1122,7 @@ pub const Repository = struct { |
| 1110 | 1122 | .symlink => .{ .blob = .{ .id = &item.id_bytes } }, |
| 1111 | 1123 | .none => unreachable, |
| 1112 | 1124 | }; |
| 1113 | | const tree: Tree = .{ .children = children_slice }; |
| 1125 | const tree: Tree = .{ .raw = obj.content, .children = children_slice }; |
| 1114 | 1126 | if (cache_behavior == .cache) try r.trees.put(r.gpa, id.id, tree); |
| 1115 | 1127 | return .{ id, tree }; |
| 1116 | 1128 | } |
| ... | ... | @@ -1630,6 +1642,7 @@ fn traverseTo(r: *Repository, arena: std.mem.Allocator, treestart_id: TreeId, di |
| 1630 | 1642 | } |
| 1631 | 1643 | |
| 1632 | 1644 | pub const Tree = struct { |
| 1645 | raw: []const u8, |
| 1633 | 1646 | children: []const Object, |
| 1634 | 1647 | |
| 1635 | 1648 | pub fn get(self: Tree, name: string) ?Object { |
| ... | ... | @@ -1915,6 +1928,7 @@ pub const Tree = struct { |
| 1915 | 1928 | }; |
| 1916 | 1929 | |
| 1917 | 1930 | pub const Commit = struct { |
| 1931 | raw: []const u8, |
| 1918 | 1932 | tree: TreeId, |
| 1919 | 1933 | parents: []const CommitId, |
| 1920 | 1934 | author: UserAndAt, |
| ... | ... | @@ -1929,6 +1943,7 @@ pub const UserAndAt = struct { |
| 1929 | 1943 | }; |
| 1930 | 1944 | |
| 1931 | 1945 | pub const Tag = struct { |
| 1946 | raw: []const u8, |
| 1932 | 1947 | object: Id, |
| 1933 | 1948 | type: RefType, |
| 1934 | 1949 | tagger: ?UserAndAt, |