diff options
| author | patrick-scho | 2024-08-10 17:09:43 +0200 |
|---|---|---|
| committer | patrick-scho | 2024-08-10 17:12:35 +0200 |
| commit | fba8e20a91f6cd9fc54c14abcd3580bf0b687332 (patch) | |
| tree | 18a9c9cea3be2e5a0ef066c72c464f83d04719a7 | |
| parent | 1eff0cba79ccb40715c7d1257f8b0743bf2b6b0b (diff) | |
| download | ziggit-fba8e20a91f6cd9fc54c14abcd3580bf0b687332.tar.gz ziggit-fba8e20a91f6cd9fc54c14abcd3580bf0b687332.zip | |
replace packfile with optional
| -rw-r--r-- | git.zig | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -326,7 +326,10 @@ const Repo = struct { } pub fn getObject(self: *Repo, id: Id) !?Object { - return self.packfile.getObject(id); + if (self.packfile) |*packfile| { + return packfile.getObject(id); + } + return null; } }; @@ -343,8 +346,10 @@ test "parse idx" { var repo = try Repo.open(std.testing.allocator, "../microwindows/.git"); defer repo.close(); - std.debug.print("{}\n", .{repo.packfile.objectOffsets.keys().len}); - std.debug.print("{}\n", .{repo.packfile.objectOffsets.values().len}); + if (repo.packfile) |packfile| { + std.debug.print("{}\n", .{packfile.objectOffsets.keys().len}); + std.debug.print("{}\n", .{packfile.objectOffsets.values().len}); + } } test "get object" { |
