From 39da44aebc515c2dfb10d78f54a48bed85444196 Mon Sep 17 00:00:00 2001 From: Meghan Denny Date: Mon, 23 Jun 2025 01:20:32 -0700 Subject: [PATCH] don't crash on trees with files with spaces in the name --- git.zig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/git.zig b/git.zig index ea40c0c3d05b71dc6b8d4ca82077f6bb014ab2de..00167a02ef61821cfa8ea2960d53c81eb9bf4119 100644 --- a/git.zig +++ b/git.zig @@ -270,8 +270,7 @@ pub fn parseTree(alloc: std.mem.Allocator, treefile: string) !Tree { var jter = std.mem.splitScalar(u8, line, ' '); const mode = jter.next().?; const otype = std.meta.stringToEnum(Tree.Object.Id.Tag, jter.next().?).?; - const id_and_name = jter.next().?; - std.debug.assert(jter.next() == null); + const id_and_name = jter.rest(); const tab_pos = std.mem.indexOfScalar(u8, id_and_name, '\t').?; // why git. why. std.debug.assert(tab_pos == 40); const id = id_and_name[0..tab_pos][0..40]; -- 2.54.0