authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-05-20 10:49:13 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-05-20 10:49:13 -07:00
log1e8374fff055a997d494d4323c3cdb1e48cc340d
tree30caabb5bd09260c54752f4858f4ac63589906a5
parent5df10192f349aabc63abcae624cac9de205d9df6

getTags: dont crash when there are none


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

git.zig+1
...@@ -610,6 +610,7 @@ pub fn getTags(alloc: std.mem.Allocator, dir: std.fs.Dir) ![]const Ref {...@@ -610,6 +610,7 @@ pub fn getTags(alloc: std.mem.Allocator, dir: std.fs.Dir) ![]const Ref {
610 .argv = &.{ "git", "show-ref", "--tags", "--dereference" },610 .argv = &.{ "git", "show-ref", "--tags", "--dereference" },
611 .max_output_bytes = 1024 * 1024 * 1024,611 .max_output_bytes = 1024 * 1024 * 1024,
612 });612 });
613 if (result.term == .Exited and result.term.Exited == 1) return &.{}; // show-ref exits 1 when there are no tags
613 std.debug.assert(result.term == .Exited and result.term.Exited == 0);614 std.debug.assert(result.term == .Exited and result.term.Exited == 0);
614 const output = std.mem.trimRight(u8, result.stdout, "\n");615 const output = std.mem.trimRight(u8, result.stdout, "\n");
615 var iter = std.mem.split(u8, output, "\n");616 var iter = std.mem.split(u8, output, "\n");