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 {...@@ -57,6 +57,7 @@ pub fn getObject(alloc: std.mem.Allocator, dir: std.fs.Dir, obj: Id) !string {
57 .argv = &.{ "git", "cat-file", "-p", obj },57 .argv = &.{ "git", "cat-file", "-p", obj },
58 .max_output_bytes = 1024 * 1024 * 1024,58 .max_output_bytes = 1024 * 1024 * 1024,
59 });59 });
60 std.debug.assert(result.term == .Exited and result.term.Exited == 0);
60 return std.mem.trimRight(u8, result.stdout, "\n");61 return std.mem.trimRight(u8, result.stdout, "\n");
61}62}
6263
...@@ -70,6 +71,7 @@ pub fn getObjectSize(alloc: std.mem.Allocator, dir: std.fs.Dir, obj: Id) !u64 {...@@ -70,6 +71,7 @@ pub fn getObjectSize(alloc: std.mem.Allocator, dir: std.fs.Dir, obj: Id) !u64 {
70 .cwd_dir = dir,71 .cwd_dir = dir,
71 .argv = &.{ "git", "cat-file", "-s", obj },72 .argv = &.{ "git", "cat-file", "-s", obj },
72 });73 });
74 std.debug.assert(result.term == .Exited and result.term.Exited == 0);
73 return try std.fmt.parseInt(u64, std.mem.trimRight(u8, result.stdout, "\n"), 10);75 return try std.fmt.parseInt(u64, std.mem.trimRight(u8, result.stdout, "\n"), 10);
74}76}
7577
...@@ -105,6 +107,7 @@ pub fn revList(alloc: std.mem.Allocator, dir: std.fs.Dir, comptime count: u31, f...@@ -105,6 +107,7 @@ pub fn revList(alloc: std.mem.Allocator, dir: std.fs.Dir, comptime count: u31, f
105 sub_path,107 sub_path,
106 },108 },
107 });109 });
110 std.debug.assert(result.term == .Exited and result.term.Exited == 0);
108 return std.mem.trimRight(u8, result.stdout, "\n");111 return std.mem.trimRight(u8, result.stdout, "\n");
109}112}
110113
...@@ -309,6 +312,7 @@ pub fn getTreeDiff(alloc: std.mem.Allocator, dir: std.fs.Dir, commitid: CommitId...@@ -309,6 +312,7 @@ pub fn getTreeDiff(alloc: std.mem.Allocator, dir: std.fs.Dir, commitid: CommitId
309 .argv = &.{ "git", "diff-tree", "-p", "--raw", "4b825dc642cb6eb9a060e54bf8d69288fbee4904", commitid.id },312 .argv = &.{ "git", "diff-tree", "-p", "--raw", "4b825dc642cb6eb9a060e54bf8d69288fbee4904", commitid.id },
310 .max_output_bytes = 1024 * 1024 * 1024,313 .max_output_bytes = 1024 * 1024 * 1024,
311 });314 });
315 std.debug.assert(result.term == .Exited and result.term.Exited == 0);
312 return std.mem.trim(u8, result.stdout, "\n");316 return std.mem.trim(u8, result.stdout, "\n");
313 }317 }
314 const result = try std.ChildProcess.exec(.{318 const result = try std.ChildProcess.exec(.{
...@@ -317,6 +321,7 @@ pub fn getTreeDiff(alloc: std.mem.Allocator, dir: std.fs.Dir, commitid: CommitId...@@ -317,6 +321,7 @@ pub fn getTreeDiff(alloc: std.mem.Allocator, dir: std.fs.Dir, commitid: CommitId
317 .argv = &.{ "git", "diff-tree", "-p", "--raw", parentid.?.id, commitid.id },321 .argv = &.{ "git", "diff-tree", "-p", "--raw", parentid.?.id, commitid.id },
318 .max_output_bytes = 1024 * 1024 * 1024,322 .max_output_bytes = 1024 * 1024 * 1024,
319 });323 });
324 std.debug.assert(result.term == .Exited and result.term.Exited == 0);
320 return std.mem.trim(u8, result.stdout, "\n");325 return std.mem.trim(u8, result.stdout, "\n");
321}326}
322327