srctree

Gregory Mullen parent 05f70238 efc71a77
debugging git apply

inlinesplit
src/endpoints/repos/diffs.zig added: 9, removed: 4, total 5
@@ -387,7 +387,7 @@ fn view(ctx: *Context) Error!void {
var agent = repo.getAgent(ctx.alloc);
const applies = agent.checkPatch(fdata) catch |err| apl: {
std.debug.print("git apply failed {any}\n", .{err});
break :apl null;
break :apl "";
};
if (applies == null) patch_applies = true;
} else |err| {
@@ -415,7 +415,7 @@ fn view(ctx: *Context) Error!void {
},
.comments = comments_,
.delta_id = delta_id,
.patch_does_not_apply = if (patch_applies) .{} else null,
.patch_does_not_apply = if (patch_applies) null else .{},
.current_username = username,
});
 
 
src/git/agent.zig added: 9, removed: 4, total 5
@@ -110,11 +110,16 @@ pub fn checkPatch(self: Agent, patch: []const u8) !?[]u8 {
"git",
"apply",
"--check",
"--index",
"--cached",
"--verbose",
"--",
}, patch);
 
if (res.term.Exited == 0) return null;
std.debug.print("git apply error {}\n", .{res.term.Exited});
std.debug.print("stderr {s}", .{res.stderr});
std.debug.print("stdout {s}", .{res.stdout});
return error.DoesNotApply;
}