fix: remove git.current_branch_cache
Not a good idea.
This commit is contained in:
parent
22b29b15b9
commit
2aba314e08
1 changed files with 0 additions and 10 deletions
10
src/git.zig
10
src/git.zig
|
@ -20,26 +20,16 @@ pub fn workspace_path(context_: usize) Error!void {
|
||||||
|
|
||||||
pub fn current_branch(context_: usize) Error!void {
|
pub fn current_branch(context_: usize) Error!void {
|
||||||
const fn_name = @src().fn_name;
|
const fn_name = @src().fn_name;
|
||||||
if (current_branch_cache) |p| {
|
|
||||||
tp.self_pid().send(.{ module_name, context_, fn_name, p.branch }) catch {};
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try git(context_, .{ "rev-parse", "--abbrev-ref", "HEAD" }, struct {
|
try git(context_, .{ "rev-parse", "--abbrev-ref", "HEAD" }, struct {
|
||||||
fn result(context: usize, parent: tp.pid_ref, output: []const u8) void {
|
fn result(context: usize, parent: tp.pid_ref, output: []const u8) void {
|
||||||
var it = std.mem.splitScalar(u8, output, '\n');
|
var it = std.mem.splitScalar(u8, output, '\n');
|
||||||
while (it.next()) |value| if (value.len > 0) {
|
while (it.next()) |value| if (value.len > 0) {
|
||||||
blk: {
|
|
||||||
current_branch_cache = .{ .branch = allocator.dupeZ(u8, value) catch break :blk };
|
|
||||||
}
|
|
||||||
parent.send(.{ module_name, context, fn_name, value }) catch {};
|
parent.send(.{ module_name, context, fn_name, value }) catch {};
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}.result, exit_null_on_error(fn_name));
|
}.result, exit_null_on_error(fn_name));
|
||||||
}
|
}
|
||||||
var current_branch_cache: ?struct {
|
|
||||||
branch: ?[:0]const u8 = null,
|
|
||||||
} = null;
|
|
||||||
|
|
||||||
pub fn workspace_files(context: usize) Error!void {
|
pub fn workspace_files(context: usize) Error!void {
|
||||||
return git_line_output(
|
return git_line_output(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue