authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-04-07 20:26:08 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-04-07 20:26:08 -07:00
log1fc4dfc12f7cd3315cb4947608e62a1e63651e8f
treea1568f16ff64fd6b251360bdac0d7e38c8b0f908
parentc13c8f2860e25e1674800059afe19c95897c26c6
signaturebadge-check Signed by SSH key SHA256:4hHJbtBRU58AYXwjL7fkz2fnQHdiye8x1QpTCQ0sHNw

Tree: add case-insensitive blob search


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

git.zig+15
...@@ -364,6 +364,21 @@ pub const Tree = struct {...@@ -364,6 +364,21 @@ pub const Tree = struct {
364 return o;364 return o;
365 }365 }
366366
367 pub fn find(self: Tree, name: string) ?Object {
368 for (self.children) |item| {
369 if (std.ascii.eqlIgnoreCase(item.name, name)) {
370 return item;
371 }
372 }
373 return null;
374 }
375
376 pub fn findBlob(self: Tree, name: string) ?Object {
377 const o = self.find(name) orelse return null;
378 if (o.id != .blob) return null;
379 return o;
380 }
381
367 pub const Object = struct {382 pub const Object = struct {
368 mode: Mode,383 mode: Mode,
369 id: @This().Id,384 id: @This().Id,