commit bd47c78ad5d0534eac28ec12379deef8f01c335d
Author: tri <tri@thac.loan>
Date:   Tue Oct 7 17:51:21 2025 +0700

    generate patches using git-format-patch instead
    
    Two things:
    
    - It can be fed into `git am`, which preserves authorship
    - It actually includes binary blobs, unlike the previous format

diff --git a/src/git.zig b/src/git.zig
index 4ae29ff..7466b3d 100644
--- a/src/git.zig
+++ b/src/git.zig
@@ -295,3 +295,20 @@ pub fn show(arena: mem.Allocator, dir: fs.Dir, commit_hash: []const u8) ![]const
     std.debug.assert(git_proc.term.Exited == 0);
     return git_proc.stdout;
 }
+
+pub fn formatPatch(arena: mem.Allocator, dir: fs.Dir, commit_hash: []const u8) ![]const u8 {
+    var proc = try std.process.Child.run(.{
+        .allocator = arena,
+        .cwd_dir = dir,
+        .max_output_bytes = 1024 * 1024 * 1024,
+        .argv = &.{
+            "git",
+            "format-patch",
+            "-1",
+            "--stdout",
+            commit_hash,
+        },
+    });
+    std.debug.assert(proc.term.Exited == 0);
+    return proc.stdout;
+}
diff --git a/src/main.zig b/src/main.zig
index fe2aa4f..4369af7 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -651,9 +651,11 @@ pub fn writeCommitPage(
     var objects_dir = try out_repo_dir.openDir(constants.web_objects_path, .{});
     defer objects_dir.close();
 
+    const patch = try git.formatPatch(arena, args.in_repo_dir, commit.hash);
+
     try objects_dir.writeFile(.{
         .sub_path = try fmt.allocPrint(arena, "{s}.patch", .{commit.hash}),
-        .data = commit_text,
+        .data = patch,
         .flags = .{},
     });
 }