From 2377c041d9c2f7325bcf1ac7695e29acdb0968d1 Mon Sep 17 00:00:00 2001 From: Squibid Date: Fri, 6 Mar 2026 12:05:52 -0500 Subject: [PATCH] add bisect information and update man page --- XD.1 | 5 +++-- src/Git.zig | 14 ++++++++++++++ src/main.zig | 7 ++++++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/XD.1 b/XD.1 index 3203ff1..d5f4253 100644 --- a/XD.1 +++ b/XD.1 @@ -26,6 +26,7 @@ tab(;) allbox; c;l. :;default \;;in a git repo + =;in a git repo during a bisect 8;in a git repo with stashed changes X;in a git repo during a merge O;in a git repo during a rebase @@ -56,8 +57,8 @@ c;l. returns the number that was passed in to allow the user to re-run the program and get the same results. If there's an internal error .Nm -returns 1. If you wish to find out more infomation about the error enable ERR -in the config.mk. +returns 1. If you wish to find out more infomation about the error pass in +-Derr at build time. .Sh OPTIONS .Ss -v Print version information to stdout and exit. diff --git a/src/Git.zig b/src/Git.zig index 8f421bb..d1b682f 100644 --- a/src/Git.zig +++ b/src/Git.zig @@ -114,6 +114,20 @@ pub fn inRebase(self: *Git) bool { }; } +pub fn inBisect(self: *Git) bool { + const s = perf.s(); + defer perf.e(s, @src()); + + const path = std.fs.path.join(self.allocator, &[_][]const u8{ + std.mem.span(self.git_path.ptr), + "BISECT_LOG", + }) catch return false; + defer self.allocator.free(path); + + std.fs.cwd().access(path, .{ .mode = .read_only }) catch return false; + return true; +} + pub fn hasStaged(self: *Git) bool { const s = perf.s(); defer perf.e(s, @src()); diff --git a/src/main.zig b/src/main.zig index 6d92890..cd2c90e 100644 --- a/src/main.zig +++ b/src/main.zig @@ -59,7 +59,12 @@ pub fn main() u8 { var git = if (config.git) try @import("Git.zig").init(allocator) orelse null; defer if (config.git and git != null) git.?.deinit(); if (config.git and git != null) { - if (git.?.hasStashes()) { + if (git.?.inBisect()) { + face[@intFromEnum(FaceParts.eyes)] = .{ + .symbol = '=', + .explanation = "The current git repo is bisecting.", + }; + } else if (git.?.hasStashes()) { face[@intFromEnum(FaceParts.eyes)] = .{ .symbol = '8', .explanation = "The current git repo has stashed changes.",