| ... | @@ -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 folder | 28 | /// dir must already be pointing at the .git folder |
| 29 | // TODO this doesnt handle when there are 0 commits | 29 | // TODO this doesnt handle when there are 0 commits |
| 30 | pub fn getHEAD(alloc: std.mem.Allocator, dir: std.fs.Dir) !?CommitId { | 30 | pub 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(); |
| 33 | | 33 | |
| 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-Objects | 74 | // https://git-scm.com/book/en/v2/Git-Internals-Git-Objects |
| 75 | // https://git-scm.com/book/en/v2/Git-Internals-Packfiles | 75 | // https://git-scm.com/book/en/v2/Git-Internals-Packfiles |
| 76 | pub fn getObject(alloc: std.mem.Allocator, dir: std.fs.Dir, obj: Id) !string { | 76 | pub 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(); |
| 79 | | 79 | |
| 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-Objects | 92 | // https://git-scm.com/book/en/v2/Git-Internals-Git-Objects |
| 93 | // https://git-scm.com/book/en/v2/Git-Internals-Packfiles | 93 | // https://git-scm.com/book/en/v2/Git-Internals-Packfiles |
| 94 | pub fn getObjectSize(alloc: std.mem.Allocator, dir: std.fs.Dir, obj: Id) !u64 { | 94 | pub 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(); |
| 97 | | 97 | |
| 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-Objects | 108 | // https://git-scm.com/book/en/v2/Git-Internals-Git-Objects |
| 109 | // https://git-scm.com/book/en/v2/Git-Internals-Packfiles | 109 | // https://git-scm.com/book/en/v2/Git-Internals-Packfiles |
| 110 | pub fn isType(alloc: std.mem.Allocator, dir: std.fs.Dir, maybeobj: Id, typ: Tree.Object.Id.Tag) !?bool { | 110 | pub 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(); |
| 113 | | 113 | |
| 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-Objects | 125 | // https://git-scm.com/book/en/v2/Git-Internals-Git-Objects |
| 126 | // https://git-scm.com/book/en/v2/Git-Internals-Packfiles | 126 | // https://git-scm.com/book/en/v2/Git-Internals-Packfiles |
| 127 | pub fn getType(alloc: std.mem.Allocator, dir: std.fs.Dir, obj: Id) !Tree.Object.Id.Tag { | 127 | pub 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(); |
| 130 | | 130 | |
| 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-Objects | 144 | // https://git-scm.com/book/en/v2/Git-Internals-Git-Objects |
| 145 | // https://git-scm.com/book/en/v2/Git-Internals-Packfiles | 145 | // https://git-scm.com/book/en/v2/Git-Internals-Packfiles |
| 146 | pub fn revList(alloc: std.mem.Allocator, dir: std.fs.Dir, comptime count: u31, from: CommitId, sub_path: string) !string { | 146 | pub 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(); |
| 149 | | 149 | |
| 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 | } |
| 165 | | 165 | |
| 166 | pub fn parseCommit(alloc: std.mem.Allocator, commitfile: string) !Commit { | 166 | pub 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(); |
| 169 | | 169 | |
| 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 | } |
| 189 | | 189 | |
| 190 | fn parseCommitUserAndAt(input: string) !Commit.UserAndAt { | 190 | fn 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(); |
| 193 | | 193 | |
| 194 | // Mitchell Hashimoto <mitchell.hashimoto@gmail.com> 1680797363 -0700 | 194 | // 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 | }; |
| 244 | | 244 | |
| 245 | pub fn parseTree(alloc: std.mem.Allocator, treefile: string) !Tree { | 245 | pub 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(); |
| 248 | | 248 | |
| 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 | } |
| 278 | | 278 | |
| 279 | fn parseTreeMode(input: string) !Tree.Object.Mode { | 279 | fn 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(); |
| 282 | | 282 | |
| 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 manually | 385 | // TODO make this inspect .git manually |
| 386 | // TODO make this return a Reader when we implement it ourselves | 386 | // TODO make this return a Reader when we implement it ourselves |
| 387 | pub fn getTreeDiff(alloc: std.mem.Allocator, dir: std.fs.Dir, commitid: CommitId, parentid: ?CommitId) !string { | 387 | pub 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(); |
| 390 | | 390 | |
| 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 | } |
| 412 | | 412 | |
| 413 | pub fn parseTreeDiffMeta(input: string) !TreeDiffMeta { | 413 | pub 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(); |
| 416 | | 416 | |
| 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 | }; |
| 486 | | 486 | |
| 487 | pub fn parseTreeDiff(alloc: std.mem.Allocator, input: string) !TreeDiff { | 487 | pub 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(); |
| 490 | | 490 | |
| 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 | }; |
| 645 | | 645 | |
| 646 | pub fn getBranches(alloc: std.mem.Allocator, dir: std.fs.Dir) ![]const Ref { | 646 | pub 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(); |
| 649 | | 649 | |
| 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 | } |
| 671 | | 671 | |
| 672 | pub fn getTags(alloc: std.mem.Allocator, dir: std.fs.Dir) ![]const Ref { | 672 | pub 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(); |
| 675 | | 675 | |
| 676 | // 97bc4b5f87656a34139e1a8122866c8c5b432598 refs/tags/1.2.5 | 676 | // 97bc4b5f87656a34139e1a8122866c8c5b432598 refs/tags/1.2.5 |