╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ event.zig ────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
797 const children = try DB.HashSet(.read_write).init(children_cursor); 798 try children.put(oid_int, .{ .bytes = &oid }); 799 pending_parent_count += 1; 800 } 801 802 if (pending_parent_count == 0) { 803 try self.ready_queue.append(.{ .bytes = &oid }); 804 } else { 805 try self.child_to_pending_parents.put(oid_int, .{ .uint = pending_parent_count }); 806 } 807 } 808 } 809 810 fn enqueueChildren(self: *CommitIterator(repo_opts), oid: *const [hash.byteLen(repo_opts.hash)]u8) !void { 811 const oid_int = hash.bytesToInt(repo_opts.hash, oid); 812 const children_cursor = try self.parent_to_children.getCursor(oid_int) orelse return; 813 const children = try DB.HashSet(.read_only).init(children_cursor); 814 var children_iter = try children.iterator(); 815 816 while (try children_iter.next()) |*child_cursor| { 817 const kv_pair = try child_cursor.readKeyValuePair(); 818 const child_oid_int = kv_pair.hash; 819 const pending_parent_cursor = try self.child_to_pending_parents.getCursor(child_oid_int) orelse return error.CursorNotFound; 820 const pending_parent_count = try pending_parent_cursor.readUint(); 821 822 if (pending_parent_count <= 1) { 823 _ = try self.child_to_pending_parents.remove(child_oid_int); 824 const child_oid = hash.intToBytes(hash.HashInt(repo_opts.hash), child_oid_int); 825 try self.ready_queue.append(.{ .bytes = &child_oid }); 826 } else { 827 try self.child_to_pending_parents.put(child_oid_int, .{ .uint = pending_parent_count - 1 }); 828 } 829 } 830 } 831 832 fn readOidFromList(list: DB.ArrayList(.read_only), index: u64) ![hash.byteLen(repo_opts.hash)]u8 { 833 const oid_cursor = try list.getCursor(index) orelse return error.CursorNotFound; 834 var oid: [hash.byteLen(repo_opts.hash)]u8 = undefined; 835 _ = try oid_cursor.readBytes(&oid); 836 return oid; 837 } 838 }; 839 } 840