X-Git-Url: https://gitweb.ps.run/ziggit/blobdiff_plain/35b99e92b6d6d478d401f5587930b7a15d6e74e0..15b4b7a21d5f8a0042b69133116b5deebc675d08:/git.zig diff --git a/git.zig b/git.zig index e21847c..8c44fb6 100644 --- a/git.zig +++ b/git.zig @@ -8,11 +8,18 @@ const MaxFileSize = 1024 * 1024; const Id = u160; const Commit = struct { + tree: Id, + parent: Id, author: []u8, + committer: []u8, message: []u8, - parent: Id, - tree: Id, }; +const TreeEntry = struct { + permissions: []u8, + name: []u8, + id: Id, +}; +const Tree = std.ArrayList(TreeEntry); const Blob = struct { data: []u8, }; @@ -30,6 +37,14 @@ const Object = struct { // pub fn getBlob(self: *Object) Blob {} }; +fn decompress(alloc: Alloc, r: Reader) ![]u8 { + var buffer = std.ArrayList(u8).init(alloc); + + try std.compress.zlib.decompress(r, buffer.writer().any()); + + return alloc.realloc(buffer.allocatedSlice(), buffer.items.len); +} + const PackFile = struct { alloc: Alloc, idxFile: std.fs.File,