authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2024-06-04 10:51:59 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2024-06-04 10:51:59 -07:00
logc48d253307c54af99caab283e87184a2d6f4649e
tree8f181bfc13bac73002938c4fe5d62d5704811f82
parentdbda0629708d4b34503945ffaeac8674735b44aa

use nektro/zig-git for .git folder introspection


5 files changed, 25 insertions(+), 6 deletions(-)

deps.zig+15-1
...@@ -61,12 +61,14 @@ pub fn fetch(exe: *std.Build.Step.Compile) *std.Build.Step {...@@ -61,12 +61,14 @@ pub fn fetch(exe: *std.Build.Step.Compile) *std.Build.Step {
61 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-ansi", "c3e439f86b0484e4428f38c4d8b07b7b5ae1634b").step);61 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-ansi", "c3e439f86b0484e4428f38c4d8b07b7b5ae1634b").step);
62 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-detect-license", "3ff57d0681b7bd7f8ca9bd092afa0b4bfe2f1afd").step);62 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-detect-license", "3ff57d0681b7bd7f8ca9bd092afa0b4bfe2f1afd").step);
63 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-extras", "74f0ddb0a4dfa7921739b88cc381951a6b6e73ce").step);63 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-extras", "74f0ddb0a4dfa7921739b88cc381951a6b6e73ce").step);
64 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-git", "103f4e419c35b88f802bb8234ece1c0a9aa40c03").step);
64 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-inquirer", "9e1d873db79e9ffa6ae6e06bd372428c9be85d97").step);65 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-inquirer", "9e1d873db79e9ffa6ae6e06bd372428c9be85d97").step);
65 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-leven", "e548b0bcc7b6f34f636c0b6b905928d31254c54d").step);66 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-leven", "e548b0bcc7b6f34f636c0b6b905928d31254c54d").step);
66 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-licenses", "f46d9f774df929885eef66c733a1e2a46bf16aec").step);67 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-licenses", "f46d9f774df929885eef66c733a1e2a46bf16aec").step);
67 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-licenses-text", "b01e5a2dffcc564bddd8f514fe64bab9b5c52572").step);68 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-licenses-text", "b01e5a2dffcc564bddd8f514fe64bab9b5c52572").step);
68 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-range", "4b2f12808aa09be4b27a163efc424dd4e0415992").step);69 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-range", "4b2f12808aa09be4b27a163efc424dd4e0415992").step);
69 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-time", "ba546bbf2e8438c9b2325f36f392c9d95b432e8e").step);70 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-time", "ba546bbf2e8438c9b2325f36f392c9d95b432e8e").step);
71 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-tracer", "ad868b45cfd445aa4d3f53cf8dda4b62b73efb54").step);
70 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-yaml", "0d17fb99cba338aedc1abac12d78d5e5f04f0b6b").step);72 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-yaml", "0d17fb99cba338aedc1abac12d78d5e5f04f0b6b").step);
71 step.dependOn(&GitExactStep.create(b, "https://github.com/truemedian/hzzp", "a7f03a1e652abe8c89b376d090cec50acb0d2a1a").step);73 step.dependOn(&GitExactStep.create(b, "https://github.com/truemedian/hzzp", "a7f03a1e652abe8c89b376d090cec50acb0d2a1a").step);
72 step.dependOn(&GitExactStep.create(b, "https://github.com/ziglibs/known-folders", "0ad514dcfb7525e32ae349b9acc0a53976f3a9fa").step);74 step.dependOn(&GitExactStep.create(b, "https://github.com/ziglibs/known-folders", "0ad514dcfb7525e32ae349b9acc0a53976f3a9fa").step);
...@@ -234,6 +236,18 @@ pub const package_data = struct {...@@ -234,6 +236,18 @@ pub const package_data = struct {
234 .entry = "/git/github.com/nektro/zig-time/ba546bbf2e8438c9b2325f36f392c9d95b432e8e/time.zig",236 .entry = "/git/github.com/nektro/zig-time/ba546bbf2e8438c9b2325f36f392c9d95b432e8e/time.zig",
235 .deps = &[_]*Package{ &_f7dubzb7cyqe },237 .deps = &[_]*Package{ &_f7dubzb7cyqe },
236 };238 };
239 pub var _ede2wygpe1iy = Package{
240 .store = "/git/github.com/nektro/zig-tracer/ad868b45cfd445aa4d3f53cf8dda4b62b73efb54",
241 .name = "tracer",
242 .entry = "/git/github.com/nektro/zig-tracer/ad868b45cfd445aa4d3f53cf8dda4b62b73efb54/src/mod.zig",
243 .deps = &[_]*Package{ &_f7dubzb7cyqe },
244 };
245 pub var _0k64oe2nuzvj = Package{
246 .store = "/git/github.com/nektro/zig-git/103f4e419c35b88f802bb8234ece1c0a9aa40c03",
247 .name = "git",
248 .entry = "/git/github.com/nektro/zig-git/103f4e419c35b88f802bb8234ece1c0a9aa40c03/git.zig",
249 .deps = &[_]*Package{ &_iecwp4b3bsfm, &_f7dubzb7cyqe, &_ede2wygpe1iy },
250 };
237 pub var _g982zq6e8wsv = Package{251 pub var _g982zq6e8wsv = Package{
238 .store = "/git/github.com/nektro/zig-yaml/0d17fb99cba338aedc1abac12d78d5e5f04f0b6b",252 .store = "/git/github.com/nektro/zig-yaml/0d17fb99cba338aedc1abac12d78d5e5f04f0b6b",
239 .name = "yaml",253 .name = "yaml",
...@@ -259,7 +273,7 @@ pub const package_data = struct {...@@ -259,7 +273,7 @@ pub const package_data = struct {
259 pub var _89ujp8gq842x = Package{273 pub var _89ujp8gq842x = Package{
260 .name = "zigmod",274 .name = "zigmod",
261 .entry = "/../..//src/lib.zig",275 .entry = "/../..//src/lib.zig",
262 .deps = &[_]*Package{ &_g982zq6e8wsv, &_s84v9o48ucb0, &_2ta738wrqbaq, &_0npcrzfdlrvk, &_ejw82j2ipa0e, &_2ovav391ivak, &_c1xirp1ota5p, &_u7sysdckdymi, &_iecwp4b3bsfm, &_f7dubzb7cyqe },276 .deps = &[_]*Package{ &_g982zq6e8wsv, &_s84v9o48ucb0, &_2ta738wrqbaq, &_0npcrzfdlrvk, &_ejw82j2ipa0e, &_2ovav391ivak, &_c1xirp1ota5p, &_u7sysdckdymi, &_iecwp4b3bsfm, &_f7dubzb7cyqe, &_0k64oe2nuzvj },
263 };277 };
264 pub var _root = Package{278 pub var _root = Package{
265 };279 };
licenses.txt+2
...@@ -8,12 +8,14 @@ MIT:...@@ -8,12 +8,14 @@ MIT:
8- git https://github.com/nektro/zig-ansi8- git https://github.com/nektro/zig-ansi
9- git https://github.com/nektro/zig-detect-license9- git https://github.com/nektro/zig-detect-license
10- git https://github.com/nektro/zig-extras10- git https://github.com/nektro/zig-extras
11- git https://github.com/nektro/zig-git
11- git https://github.com/nektro/zig-inquirer12- git https://github.com/nektro/zig-inquirer
12- git https://github.com/nektro/zig-leven13- git https://github.com/nektro/zig-leven
13- git https://github.com/nektro/zig-licenses14- git https://github.com/nektro/zig-licenses
14- git https://github.com/nektro/zig-licenses-text15- git https://github.com/nektro/zig-licenses-text
15- git https://github.com/nektro/zig-range16- git https://github.com/nektro/zig-range
16- git https://github.com/nektro/zig-time17- git https://github.com/nektro/zig-time
18- git https://github.com/nektro/zig-tracer
17- git https://github.com/nektro/zig-yaml19- git https://github.com/nektro/zig-yaml
18- git https://github.com/truemedian/hzzp20- git https://github.com/truemedian/hzzp
19- git https://github.com/ziglibs/known-folders21- git https://github.com/ziglibs/known-folders
src/util/funcs.zig+5-5
...@@ -2,6 +2,7 @@ const std = @import("std");...@@ -2,6 +2,7 @@ const std = @import("std");
2const string = []const u8;2const string = []const u8;
3const gpa = std.heap.c_allocator;3const gpa = std.heap.c_allocator;
4const extras = @import("extras");4const extras = @import("extras");
5const git = @import("git");
56
6const u = @import("index.zig");7const u = @import("index.zig");
78
...@@ -147,11 +148,10 @@ pub fn do_hash(comptime algo: type, data: string) ![algo.digest_length * 2]u8 {...@@ -147,11 +148,10 @@ pub fn do_hash(comptime algo: type, data: string) ![algo.digest_length * 2]u8 {
147148
148/// Returns the result of running `git rev-parse HEAD`149/// Returns the result of running `git rev-parse HEAD`
149pub fn git_rev_HEAD(alloc: std.mem.Allocator, dir: std.fs.Dir) !string {150pub fn git_rev_HEAD(alloc: std.mem.Allocator, dir: std.fs.Dir) !string {
150 const dirg = try dir.openDir(".git", .{});151 var dirg = try dir.openDir(".git", .{});
151 const h = std.mem.trim(u8, try dirg.readFileAlloc(alloc, "HEAD", 50), "\n");152 defer dirg.close();
152 if (!std.mem.startsWith(u8, h, "ref:")) return h;153 const commitid = try git.getHEAD(alloc, dirg);
153 const r = std.mem.trim(u8, try dirg.readFileAlloc(alloc, h[5..], 50), "\n");154 return if (commitid) |_| commitid.?.id else error.NotAGitRepo;
154 return r;
155}155}
156156
157pub fn slice(comptime T: type, input: []const T, from: usize, to: usize) []const T {157pub fn slice(comptime T: type, input: []const T, from: usize, to: usize) []const T {
zig.mod+1
...@@ -15,6 +15,7 @@ dependencies:...@@ -15,6 +15,7 @@ dependencies:
15 - src: git https://github.com/nektro/arqv-ini15 - src: git https://github.com/nektro/arqv-ini
16 - src: git https://github.com/nektro/zig-time16 - src: git https://github.com/nektro/zig-time
17 - src: git https://github.com/nektro/zig-extras17 - src: git https://github.com/nektro/zig-extras
18 - src: git https://github.com/nektro/zig-git
1819
19root_dependencies:20root_dependencies:
20 - src: git https://github.com/marlersoft/zigwin3221 - src: git https://github.com/marlersoft/zigwin32
zigmod.lock+2
...@@ -6,12 +6,14 @@ git https://github.com/nektro/zfetch commit-863be236188e5f24d16554f9dcd7df96dd25...@@ -6,12 +6,14 @@ git https://github.com/nektro/zfetch commit-863be236188e5f24d16554f9dcd7df96dd25
6git https://github.com/nektro/zig-ansi commit-c3e439f86b0484e4428f38c4d8b07b7b5ae1634b6git https://github.com/nektro/zig-ansi commit-c3e439f86b0484e4428f38c4d8b07b7b5ae1634b
7git https://github.com/nektro/zig-detect-license commit-3ff57d0681b7bd7f8ca9bd092afa0b4bfe2f1afd7git https://github.com/nektro/zig-detect-license commit-3ff57d0681b7bd7f8ca9bd092afa0b4bfe2f1afd
8git https://github.com/nektro/zig-extras commit-74f0ddb0a4dfa7921739b88cc381951a6b6e73ce8git https://github.com/nektro/zig-extras commit-74f0ddb0a4dfa7921739b88cc381951a6b6e73ce
9git https://github.com/nektro/zig-git commit-103f4e419c35b88f802bb8234ece1c0a9aa40c03
9git https://github.com/nektro/zig-inquirer commit-9e1d873db79e9ffa6ae6e06bd372428c9be85d9710git https://github.com/nektro/zig-inquirer commit-9e1d873db79e9ffa6ae6e06bd372428c9be85d97
10git https://github.com/nektro/zig-leven commit-e548b0bcc7b6f34f636c0b6b905928d31254c54d11git https://github.com/nektro/zig-leven commit-e548b0bcc7b6f34f636c0b6b905928d31254c54d
11git https://github.com/nektro/zig-licenses commit-f46d9f774df929885eef66c733a1e2a46bf16aec12git https://github.com/nektro/zig-licenses commit-f46d9f774df929885eef66c733a1e2a46bf16aec
12git https://github.com/nektro/zig-licenses-text commit-b01e5a2dffcc564bddd8f514fe64bab9b5c5257213git https://github.com/nektro/zig-licenses-text commit-b01e5a2dffcc564bddd8f514fe64bab9b5c52572
13git https://github.com/nektro/zig-range commit-4b2f12808aa09be4b27a163efc424dd4e041599214git https://github.com/nektro/zig-range commit-4b2f12808aa09be4b27a163efc424dd4e0415992
14git https://github.com/nektro/zig-time commit-ba546bbf2e8438c9b2325f36f392c9d95b432e8e15git https://github.com/nektro/zig-time commit-ba546bbf2e8438c9b2325f36f392c9d95b432e8e
16git https://github.com/nektro/zig-tracer commit-ad868b45cfd445aa4d3f53cf8dda4b62b73efb54
15git https://github.com/nektro/zig-yaml commit-0d17fb99cba338aedc1abac12d78d5e5f04f0b6b17git https://github.com/nektro/zig-yaml commit-0d17fb99cba338aedc1abac12d78d5e5f04f0b6b
16git https://github.com/truemedian/hzzp commit-a7f03a1e652abe8c89b376d090cec50acb0d2a1a18git https://github.com/truemedian/hzzp commit-a7f03a1e652abe8c89b376d090cec50acb0d2a1a
17git https://github.com/ziglibs/known-folders commit-0ad514dcfb7525e32ae349b9acc0a53976f3a9fa19git https://github.com/ziglibs/known-folders commit-0ad514dcfb7525e32ae349b9acc0a53976f3a9fa