download patch
commit e22ece2d2e2ed914df502f77f4ab483078b2097d
Author: tri <tri@thac.loan>
Date: Fri Jan 2 00:20:23 2026 +0700
increase blob limit from 64->256MiB; use zig 0.15.2
diff --git a/README.md b/README.md
index 9f8919d..282ea61 100644
--- a/README.md
+++ b/README.md
It's a static site generator for your git repos - think [stagit][1], but `git cl
## Build
-We use zig master, which is 0.16.0-dev.393+dd4be26f5 at the time of writing:
+We use zig 0.15.2:
```sh
# khoe is hosted on khoe
diff --git a/src/git.zig b/src/git.zig
index 7466b3d..7e09598 100644
--- a/src/git.zig
+++ b/src/git.zig
const Io = std.Io;
const t = std.testing;
pub fn findGitDir(arena: mem.Allocator, dir: fs.Dir) ![]const u8 {
- var proc = try std.process.Child.run(.{
+ const proc = try std.process.Child.run(.{
.allocator = arena,
.cwd_dir = dir,
.argv = &.{ "git", "rev-parse", "--git-dir" },
pub fn findGitDir(arena: mem.Allocator, dir: fs.Dir) ![]const u8 {
}
pub fn updateServerInfo(gpa: mem.Allocator, dir: fs.Dir) !void {
- var proc = try std.process.Child.run(.{
+ const proc = try std.process.Child.run(.{
.allocator = gpa,
.cwd_dir = dir,
.argv = &.{ "git", "update-server-info" },
pub fn getLatestCommit(arena: mem.Allocator, dir: fs.Dir) !?Commit {
pub fn getDescription(arena: mem.Allocator, git_dir: fs.Dir) ![]const u8 {
const description = git_dir.readFileAlloc(
- "description",
arena,
- .limited(4096),
+ "description",
+ 4096,
) catch |err| {
switch (err) {
error.FileNotFound => return "",
pub fn getDescription(arena: mem.Allocator, git_dir: fs.Dir) ![]const u8 {
/// If found, return the exact readme filename.
pub fn findReadme(arena: mem.Allocator, dir: fs.Dir) !?[]const u8 {
- var proc = try std.process.Child.run(.{
+ const proc = try std.process.Child.run(.{
.allocator = arena,
.cwd_dir = dir,
// can't run git-ls-files on bare repos, so use git-ls-tree instead:
pub fn findReadme(arena: mem.Allocator, dir: fs.Dir) !?[]const u8 {
}
pub fn readFileAlloc(arena: mem.Allocator, dir: fs.Dir, file_name: []const u8) ![]const u8 {
- var proc = try std.process.Child.run(.{
+ const proc = try std.process.Child.run(.{
.allocator = arena,
.cwd_dir = dir,
.argv = &.{
pub const Walker = struct {
};
pub fn walkTree(arena: mem.Allocator, dir: fs.Dir, tree_ref: []const u8) !Walker {
- var proc = try std.process.Child.run(.{
+ const proc = try std.process.Child.run(.{
.allocator = arena,
.cwd_dir = dir,
.max_output_bytes = 1024 * 1024 * 64,
pub fn walkTree(arena: mem.Allocator, dir: fs.Dir, tree_ref: []const u8) !Walker
pub const ObjectType = enum { blob, commit, tree, other };
pub fn objectType(arena: mem.Allocator, dir: fs.Dir, object_hash: []const u8) !ObjectType {
- var proc = try std.process.Child.run(.{
+ const proc = try std.process.Child.run(.{
.allocator = arena,
.cwd_dir = dir,
.max_output_bytes = 1024 * 1024 * 64,
pub fn isBinary(content: []const u8) bool {
// TODO: instead of loading everything to memory, figure out how to stream
// instead.
pub fn catFile(arena: mem.Allocator, dir: fs.Dir, object_hash: []const u8) ![]const u8 {
- var proc = try std.process.Child.run(.{
+ const proc = try std.process.Child.run(.{
.allocator = arena,
.cwd_dir = dir,
- .max_output_bytes = 1024 * 1024 * 64,
+ .max_output_bytes = 1024 * 1024 * 256,
.argv = &.{
"git",
"cat-file",
pub fn catFile(arena: mem.Allocator, dir: fs.Dir, object_hash: []const u8) ![]co
pub fn show(arena: mem.Allocator, dir: fs.Dir, commit_hash: []const u8) ![]const u8 {
// First get git's terminal output with color codes intact
- var git_proc = try std.process.Child.run(.{
+ const git_proc = try std.process.Child.run(.{
.allocator = arena,
.cwd_dir = dir,
.max_output_bytes = 1024 * 1024 * 64,
pub fn show(arena: mem.Allocator, dir: fs.Dir, commit_hash: []const u8) ![]const
}
pub fn formatPatch(arena: mem.Allocator, dir: fs.Dir, commit_hash: []const u8) ![]const u8 {
- var proc = try std.process.Child.run(.{
+ const proc = try std.process.Child.run(.{
.allocator = arena,
.cwd_dir = dir,
.max_output_bytes = 1024 * 1024 * 1024,