authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-11-24 12:13:46 -08:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-11-24 12:13:46 -08:00
loge740ed3459ee9eab32ed2e2fabb4ee670dcd8094
tree488e03ec3c9eb419fbe67b49f5ebfffe3da2e8f6
parentb291df3aa42c279eb53dbdefb0f1026948d92368

tracer added a fmt param


1 files changed, 15 insertions(+), 15 deletions(-)

git.zig+15-15
...@@ -28,7 +28,7 @@ pub fn version(alloc: std.mem.Allocator) !string {...@@ -28,7 +28,7 @@ pub fn version(alloc: std.mem.Allocator) !string {
28/// dir must already be pointing at the .git folder28/// dir must already be pointing at the .git folder
29// TODO this doesnt handle when there are 0 commits29// TODO this doesnt handle when there are 0 commits
30pub fn getHEAD(alloc: std.mem.Allocator, dir: std.fs.Dir) !?CommitId {30pub fn getHEAD(alloc: std.mem.Allocator, dir: std.fs.Dir) !?CommitId {
31 const t = tracer.trace(@src());31 const t = tracer.trace(@src(), "", .{});
32 defer t.end();32 defer t.end();
3333
34 const h = std.mem.trimRight(u8, try dir.readFileAlloc(alloc, "HEAD", 1024), "\n");34 const h = std.mem.trimRight(u8, try dir.readFileAlloc(alloc, "HEAD", 1024), "\n");
...@@ -74,7 +74,7 @@ fn ensureObjId(comptime T: type, input: string) T {...@@ -74,7 +74,7 @@ fn ensureObjId(comptime T: type, input: string) T {
74// https://git-scm.com/book/en/v2/Git-Internals-Git-Objects74// https://git-scm.com/book/en/v2/Git-Internals-Git-Objects
75// https://git-scm.com/book/en/v2/Git-Internals-Packfiles75// https://git-scm.com/book/en/v2/Git-Internals-Packfiles
76pub fn getObject(alloc: std.mem.Allocator, dir: std.fs.Dir, obj: Id) !string {76pub fn getObject(alloc: std.mem.Allocator, dir: std.fs.Dir, obj: Id) !string {
77 const t = tracer.trace(@src());77 const t = tracer.trace(@src(), "", .{});
78 defer t.end();78 defer t.end();
7979
80 const result = try std.ChildProcess.exec(.{80 const result = try std.ChildProcess.exec(.{
...@@ -92,7 +92,7 @@ pub fn getObject(alloc: std.mem.Allocator, dir: std.fs.Dir, obj: Id) !string {...@@ -92,7 +92,7 @@ pub fn getObject(alloc: std.mem.Allocator, dir: std.fs.Dir, obj: Id) !string {
92// https://git-scm.com/book/en/v2/Git-Internals-Git-Objects92// https://git-scm.com/book/en/v2/Git-Internals-Git-Objects
93// https://git-scm.com/book/en/v2/Git-Internals-Packfiles93// https://git-scm.com/book/en/v2/Git-Internals-Packfiles
94pub fn getObjectSize(alloc: std.mem.Allocator, dir: std.fs.Dir, obj: Id) !u64 {94pub fn getObjectSize(alloc: std.mem.Allocator, dir: std.fs.Dir, obj: Id) !u64 {
95 const t = tracer.trace(@src());95 const t = tracer.trace(@src(), "", .{});
96 defer t.end();96 defer t.end();
9797
98 const result = try std.ChildProcess.exec(.{98 const result = try std.ChildProcess.exec(.{
...@@ -108,7 +108,7 @@ pub fn getObjectSize(alloc: std.mem.Allocator, dir: std.fs.Dir, obj: Id) !u64 {...@@ -108,7 +108,7 @@ pub fn getObjectSize(alloc: std.mem.Allocator, dir: std.fs.Dir, obj: Id) !u64 {
108// https://git-scm.com/book/en/v2/Git-Internals-Git-Objects108// https://git-scm.com/book/en/v2/Git-Internals-Git-Objects
109// https://git-scm.com/book/en/v2/Git-Internals-Packfiles109// https://git-scm.com/book/en/v2/Git-Internals-Packfiles
110pub fn isType(alloc: std.mem.Allocator, dir: std.fs.Dir, maybeobj: Id, typ: Tree.Object.Id.Tag) !?bool {110pub fn isType(alloc: std.mem.Allocator, dir: std.fs.Dir, maybeobj: Id, typ: Tree.Object.Id.Tag) !?bool {
111 const t = tracer.trace(@src());111 const t = tracer.trace(@src(), "", .{});
112 defer t.end();112 defer t.end();
113113
114 const result = try std.ChildProcess.exec(.{114 const result = try std.ChildProcess.exec(.{
...@@ -125,7 +125,7 @@ pub fn isType(alloc: std.mem.Allocator, dir: std.fs.Dir, maybeobj: Id, typ: Tree...@@ -125,7 +125,7 @@ pub fn isType(alloc: std.mem.Allocator, dir: std.fs.Dir, maybeobj: Id, typ: Tree
125// https://git-scm.com/book/en/v2/Git-Internals-Git-Objects125// https://git-scm.com/book/en/v2/Git-Internals-Git-Objects
126// https://git-scm.com/book/en/v2/Git-Internals-Packfiles126// https://git-scm.com/book/en/v2/Git-Internals-Packfiles
127pub fn getType(alloc: std.mem.Allocator, dir: std.fs.Dir, obj: Id) !Tree.Object.Id.Tag {127pub fn getType(alloc: std.mem.Allocator, dir: std.fs.Dir, obj: Id) !Tree.Object.Id.Tag {
128 const t = tracer.trace(@src());128 const t = tracer.trace(@src(), "", .{});
129 defer t.end();129 defer t.end();
130130
131 const result = try std.ChildProcess.exec(.{131 const result = try std.ChildProcess.exec(.{
...@@ -144,7 +144,7 @@ pub fn getType(alloc: std.mem.Allocator, dir: std.fs.Dir, obj: Id) !Tree.Object....@@ -144,7 +144,7 @@ pub fn getType(alloc: std.mem.Allocator, dir: std.fs.Dir, obj: Id) !Tree.Object.
144// https://git-scm.com/book/en/v2/Git-Internals-Git-Objects144// https://git-scm.com/book/en/v2/Git-Internals-Git-Objects
145// https://git-scm.com/book/en/v2/Git-Internals-Packfiles145// https://git-scm.com/book/en/v2/Git-Internals-Packfiles
146pub fn revList(alloc: std.mem.Allocator, dir: std.fs.Dir, comptime count: u31, from: CommitId, sub_path: string) !string {146pub fn revList(alloc: std.mem.Allocator, dir: std.fs.Dir, comptime count: u31, from: CommitId, sub_path: string) !string {
147 const t = tracer.trace(@src());147 const t = tracer.trace(@src(), "", .{});
148 defer t.end();148 defer t.end();
149149
150 const result = try std.ChildProcess.exec(.{150 const result = try std.ChildProcess.exec(.{
...@@ -164,7 +164,7 @@ pub fn revList(alloc: std.mem.Allocator, dir: std.fs.Dir, comptime count: u31, f...@@ -164,7 +164,7 @@ pub fn revList(alloc: std.mem.Allocator, dir: std.fs.Dir, comptime count: u31, f
164}164}
165165
166pub fn parseCommit(alloc: std.mem.Allocator, commitfile: string) !Commit {166pub fn parseCommit(alloc: std.mem.Allocator, commitfile: string) !Commit {
167 const t = tracer.trace(@src());167 const t = tracer.trace(@src(), "", .{});
168 defer t.end();168 defer t.end();
169169
170 var iter = std.mem.split(u8, commitfile, "\n");170 var iter = std.mem.split(u8, commitfile, "\n");
...@@ -188,7 +188,7 @@ pub fn parseCommit(alloc: std.mem.Allocator, commitfile: string) !Commit {...@@ -188,7 +188,7 @@ pub fn parseCommit(alloc: std.mem.Allocator, commitfile: string) !Commit {
188}188}
189189
190fn parseCommitUserAndAt(input: string) !Commit.UserAndAt {190fn parseCommitUserAndAt(input: string) !Commit.UserAndAt {
191 const t = tracer.trace(@src());191 const t = tracer.trace(@src(), "", .{});
192 defer t.end();192 defer t.end();
193193
194 // Mitchell Hashimoto <mitchell.hashimoto@gmail.com> 1680797363 -0700194 // Mitchell Hashimoto <mitchell.hashimoto@gmail.com> 1680797363 -0700
...@@ -243,7 +243,7 @@ pub const Commit = struct {...@@ -243,7 +243,7 @@ pub const Commit = struct {
243};243};
244244
245pub fn parseTree(alloc: std.mem.Allocator, treefile: string) !Tree {245pub fn parseTree(alloc: std.mem.Allocator, treefile: string) !Tree {
246 const t = tracer.trace(@src());246 const t = tracer.trace(@src(), "", .{});
247 defer t.end();247 defer t.end();
248248
249 var iter = std.mem.split(u8, treefile, "\n");249 var iter = std.mem.split(u8, treefile, "\n");
...@@ -277,7 +277,7 @@ pub fn parseTree(alloc: std.mem.Allocator, treefile: string) !Tree {...@@ -277,7 +277,7 @@ pub fn parseTree(alloc: std.mem.Allocator, treefile: string) !Tree {
277}277}
278278
279fn parseTreeMode(input: string) !Tree.Object.Mode {279fn parseTreeMode(input: string) !Tree.Object.Mode {
280 const t = tracer.trace(@src());280 const t = tracer.trace(@src(), "", .{});
281 defer t.end();281 defer t.end();
282282
283 std.debug.assert(input.len == 6);283 std.debug.assert(input.len == 6);
...@@ -385,7 +385,7 @@ pub const Tree = struct {...@@ -385,7 +385,7 @@ pub const Tree = struct {
385// TODO make this inspect .git manually385// TODO make this inspect .git manually
386// TODO make this return a Reader when we implement it ourselves386// TODO make this return a Reader when we implement it ourselves
387pub fn getTreeDiff(alloc: std.mem.Allocator, dir: std.fs.Dir, commitid: CommitId, parentid: ?CommitId) !string {387pub fn getTreeDiff(alloc: std.mem.Allocator, dir: std.fs.Dir, commitid: CommitId, parentid: ?CommitId) !string {
388 const t = tracer.trace(@src());388 const t = tracer.trace(@src(), "", .{});
389 defer t.end();389 defer t.end();
390390
391 if (parentid == null) {391 if (parentid == null) {
...@@ -411,7 +411,7 @@ pub fn getTreeDiff(alloc: std.mem.Allocator, dir: std.fs.Dir, commitid: CommitId...@@ -411,7 +411,7 @@ pub fn getTreeDiff(alloc: std.mem.Allocator, dir: std.fs.Dir, commitid: CommitId
411}411}
412412
413pub fn parseTreeDiffMeta(input: string) !TreeDiffMeta {413pub fn parseTreeDiffMeta(input: string) !TreeDiffMeta {
414 const t = tracer.trace(@src());414 const t = tracer.trace(@src(), "", .{});
415 defer t.end();415 defer t.end();
416416
417 var result = std.mem.zeroes(TreeDiffMeta);417 var result = std.mem.zeroes(TreeDiffMeta);
...@@ -485,7 +485,7 @@ pub const TreeDiffMeta = struct {...@@ -485,7 +485,7 @@ pub const TreeDiffMeta = struct {
485};485};
486486
487pub fn parseTreeDiff(alloc: std.mem.Allocator, input: string) !TreeDiff {487pub fn parseTreeDiff(alloc: std.mem.Allocator, input: string) !TreeDiff {
488 const t = tracer.trace(@src());488 const t = tracer.trace(@src(), "", .{});
489 defer t.end();489 defer t.end();
490490
491 var lineiter = std.mem.split(u8, input, "\n");491 var lineiter = std.mem.split(u8, input, "\n");
...@@ -644,7 +644,7 @@ pub const TreeDiff = struct {...@@ -644,7 +644,7 @@ pub const TreeDiff = struct {
644};644};
645645
646pub fn getBranches(alloc: std.mem.Allocator, dir: std.fs.Dir) ![]const Ref {646pub fn getBranches(alloc: std.mem.Allocator, dir: std.fs.Dir) ![]const Ref {
647 const t = tracer.trace(@src());647 const t = tracer.trace(@src(), "", .{});
648 defer t.end();648 defer t.end();
649649
650 const result = try std.ChildProcess.exec(.{650 const result = try std.ChildProcess.exec(.{
...@@ -670,7 +670,7 @@ pub fn getBranches(alloc: std.mem.Allocator, dir: std.fs.Dir) ![]const Ref {...@@ -670,7 +670,7 @@ pub fn getBranches(alloc: std.mem.Allocator, dir: std.fs.Dir) ![]const Ref {
670}670}
671671
672pub fn getTags(alloc: std.mem.Allocator, dir: std.fs.Dir) ![]const Ref {672pub fn getTags(alloc: std.mem.Allocator, dir: std.fs.Dir) ![]const Ref {
673 const t = tracer.trace(@src());673 const t = tracer.trace(@src(), "", .{});
674 defer t.end();674 defer t.end();
675675
676 // 97bc4b5f87656a34139e1a8122866c8c5b432598 refs/tags/1.2.5676 // 97bc4b5f87656a34139e1a8122866c8c5b432598 refs/tags/1.2.5