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 {
6161 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-ansi", "c3e439f86b0484e4428f38c4d8b07b7b5ae1634b").step);
6262 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-detect-license", "3ff57d0681b7bd7f8ca9bd092afa0b4bfe2f1afd").step);
6363 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);
6465 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-inquirer", "9e1d873db79e9ffa6ae6e06bd372428c9be85d97").step);
6566 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-leven", "e548b0bcc7b6f34f636c0b6b905928d31254c54d").step);
6667 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-licenses", "f46d9f774df929885eef66c733a1e2a46bf16aec").step);
6768 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-licenses-text", "b01e5a2dffcc564bddd8f514fe64bab9b5c52572").step);
6869 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-range", "4b2f12808aa09be4b27a163efc424dd4e0415992").step);
6970 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);
7072 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-yaml", "0d17fb99cba338aedc1abac12d78d5e5f04f0b6b").step);
7173 step.dependOn(&GitExactStep.create(b, "https://github.com/truemedian/hzzp", "a7f03a1e652abe8c89b376d090cec50acb0d2a1a").step);
7274 step.dependOn(&GitExactStep.create(b, "https://github.com/ziglibs/known-folders", "0ad514dcfb7525e32ae349b9acc0a53976f3a9fa").step);
......@@ -234,6 +236,18 @@ pub const package_data = struct {
234236 .entry = "/git/github.com/nektro/zig-time/ba546bbf2e8438c9b2325f36f392c9d95b432e8e/time.zig",
235237 .deps = &[_]*Package{ &_f7dubzb7cyqe },
236238 };
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 };
237251 pub var _g982zq6e8wsv = Package{
238252 .store = "/git/github.com/nektro/zig-yaml/0d17fb99cba338aedc1abac12d78d5e5f04f0b6b",
239253 .name = "yaml",
......@@ -259,7 +273,7 @@ pub const package_data = struct {
259273 pub var _89ujp8gq842x = Package{
260274 .name = "zigmod",
261275 .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 },
263277 };
264278 pub var _root = Package{
265279 };
licenses.txt+2
......@@ -8,12 +8,14 @@ MIT:
88- git https://github.com/nektro/zig-ansi
99- git https://github.com/nektro/zig-detect-license
1010- git https://github.com/nektro/zig-extras
11- git https://github.com/nektro/zig-git
1112- git https://github.com/nektro/zig-inquirer
1213- git https://github.com/nektro/zig-leven
1314- git https://github.com/nektro/zig-licenses
1415- git https://github.com/nektro/zig-licenses-text
1516- git https://github.com/nektro/zig-range
1617- git https://github.com/nektro/zig-time
18- git https://github.com/nektro/zig-tracer
1719- git https://github.com/nektro/zig-yaml
1820- git https://github.com/truemedian/hzzp
1921- git https://github.com/ziglibs/known-folders
src/util/funcs.zig+5-5
......@@ -2,6 +2,7 @@ const std = @import("std");
22const string = []const u8;
33const gpa = std.heap.c_allocator;
44const extras = @import("extras");
5const git = @import("git");
56
67const u = @import("index.zig");
78
......@@ -147,11 +148,10 @@ pub fn do_hash(comptime algo: type, data: string) ![algo.digest_length * 2]u8 {
147148
148149/// Returns the result of running `git rev-parse HEAD`
149150pub fn git_rev_HEAD(alloc: std.mem.Allocator, dir: std.fs.Dir) !string {
150 const dirg = try dir.openDir(".git", .{});
151 const h = std.mem.trim(u8, try dirg.readFileAlloc(alloc, "HEAD", 50), "\n");
152 if (!std.mem.startsWith(u8, h, "ref:")) return h;
153 const r = std.mem.trim(u8, try dirg.readFileAlloc(alloc, h[5..], 50), "\n");
154 return r;
151 var dirg = try dir.openDir(".git", .{});
152 defer dirg.close();
153 const commitid = try git.getHEAD(alloc, dirg);
154 return if (commitid) |_| commitid.?.id else error.NotAGitRepo;
155155}
156156
157157pub fn slice(comptime T: type, input: []const T, from: usize, to: usize) []const T {
zig.mod+1
......@@ -15,6 +15,7 @@ dependencies:
1515 - src: git https://github.com/nektro/arqv-ini
1616 - src: git https://github.com/nektro/zig-time
1717 - src: git https://github.com/nektro/zig-extras
18 - src: git https://github.com/nektro/zig-git
1819
1920root_dependencies:
2021 - src: git https://github.com/marlersoft/zigwin32
zigmod.lock+2
......@@ -6,12 +6,14 @@ git https://github.com/nektro/zfetch commit-863be236188e5f24d16554f9dcd7df96dd25
66git https://github.com/nektro/zig-ansi commit-c3e439f86b0484e4428f38c4d8b07b7b5ae1634b
77git https://github.com/nektro/zig-detect-license commit-3ff57d0681b7bd7f8ca9bd092afa0b4bfe2f1afd
88git https://github.com/nektro/zig-extras commit-74f0ddb0a4dfa7921739b88cc381951a6b6e73ce
9git https://github.com/nektro/zig-git commit-103f4e419c35b88f802bb8234ece1c0a9aa40c03
910git https://github.com/nektro/zig-inquirer commit-9e1d873db79e9ffa6ae6e06bd372428c9be85d97
1011git https://github.com/nektro/zig-leven commit-e548b0bcc7b6f34f636c0b6b905928d31254c54d
1112git https://github.com/nektro/zig-licenses commit-f46d9f774df929885eef66c733a1e2a46bf16aec
1213git https://github.com/nektro/zig-licenses-text commit-b01e5a2dffcc564bddd8f514fe64bab9b5c52572
1314git https://github.com/nektro/zig-range commit-4b2f12808aa09be4b27a163efc424dd4e0415992
1415git https://github.com/nektro/zig-time commit-ba546bbf2e8438c9b2325f36f392c9d95b432e8e
16git https://github.com/nektro/zig-tracer commit-ad868b45cfd445aa4d3f53cf8dda4b62b73efb54
1517git https://github.com/nektro/zig-yaml commit-0d17fb99cba338aedc1abac12d78d5e5f04f0b6b
1618git https://github.com/truemedian/hzzp commit-a7f03a1e652abe8c89b376d090cec50acb0d2a1a
1719git https://github.com/ziglibs/known-folders commit-0ad514dcfb7525e32ae349b9acc0a53976f3a9fa