authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-05-08 04:24:29 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-05-08 04:24:29 -07:00
log0388abb98856ee28b48571e5ab36911f4d53a5b7
treefba6e893ac3d4dd745a6d513101b44b4ee06b4c5
parent0c9973661168106f5ed53a1994da6dfe1e394841

assert in debug mode that the childprocess functions exit 0 when using stdout


1 files changed, 5 insertions(+), 0 deletions(-)

git.zig+5
......@@ -57,6 +57,7 @@ pub fn getObject(alloc: std.mem.Allocator, dir: std.fs.Dir, obj: Id) !string {
5757 .argv = &.{ "git", "cat-file", "-p", obj },
5858 .max_output_bytes = 1024 * 1024 * 1024,
5959 });
60 std.debug.assert(result.term == .Exited and result.term.Exited == 0);
6061 return std.mem.trimRight(u8, result.stdout, "\n");
6162}
6263
......@@ -70,6 +71,7 @@ pub fn getObjectSize(alloc: std.mem.Allocator, dir: std.fs.Dir, obj: Id) !u64 {
7071 .cwd_dir = dir,
7172 .argv = &.{ "git", "cat-file", "-s", obj },
7273 });
74 std.debug.assert(result.term == .Exited and result.term.Exited == 0);
7375 return try std.fmt.parseInt(u64, std.mem.trimRight(u8, result.stdout, "\n"), 10);
7476}
7577
......@@ -105,6 +107,7 @@ pub fn revList(alloc: std.mem.Allocator, dir: std.fs.Dir, comptime count: u31, f
105107 sub_path,
106108 },
107109 });
110 std.debug.assert(result.term == .Exited and result.term.Exited == 0);
108111 return std.mem.trimRight(u8, result.stdout, "\n");
109112}
110113
......@@ -309,6 +312,7 @@ pub fn getTreeDiff(alloc: std.mem.Allocator, dir: std.fs.Dir, commitid: CommitId
309312 .argv = &.{ "git", "diff-tree", "-p", "--raw", "4b825dc642cb6eb9a060e54bf8d69288fbee4904", commitid.id },
310313 .max_output_bytes = 1024 * 1024 * 1024,
311314 });
315 std.debug.assert(result.term == .Exited and result.term.Exited == 0);
312316 return std.mem.trim(u8, result.stdout, "\n");
313317 }
314318 const result = try std.ChildProcess.exec(.{
......@@ -317,6 +321,7 @@ pub fn getTreeDiff(alloc: std.mem.Allocator, dir: std.fs.Dir, commitid: CommitId
317321 .argv = &.{ "git", "diff-tree", "-p", "--raw", parentid.?.id, commitid.id },
318322 .max_output_bytes = 1024 * 1024 * 1024,
319323 });
324 std.debug.assert(result.term == .Exited and result.term.Exited == 0);
320325 return std.mem.trim(u8, result.stdout, "\n");
321326}
322327