refactor: fix error handling in git.rev_parse

This commit is contained in:
CJ van den Berg 2025-12-15 23:25:33 +01:00
parent 5fd499d141
commit 79a184aa4a
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -273,9 +273,9 @@ pub fn rev_parse(context_: usize, rev: []const u8, file_path: []const u8) Error!
var arg: std.Io.Writer.Allocating = .init(allocator);
defer arg.deinit();
if (file_path.len == 0)
arg.writer.print("{s}", .{rev})
try arg.writer.print("{s}", .{rev})
else
arg.writer.print("{s}:{s}", .{ rev, file_path });
try arg.writer.print("{s}:{s}", .{ rev, file_path });
try git(context_, .{ "rev-parse", arg.written() }, struct {
fn result(context: usize, parent: tp.pid_ref, output: []const u8) void {
var it = std.mem.splitScalar(u8, output, '\n');