╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ ui.zig ───────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
147 } 148 try std.testing.expectEqual(null, try Events.sync(io, allocator, .{ .path = local_path, .repo_kind = .git })); 149 150 var local = try Repo.open(io, allocator, .{ .path = local_path }); 151 defer local.deinit(io, allocator); 152 var head_buffer: [xit.ref.MAX_REF_CONTENT_SIZE]u8 = undefined; 153 const head = try local.head(io, &head_buffer); 154 switch (head) { 155 .ref => |ref| try std.testing.expectEqualStrings("master", ref.name), 156 .oid => return error.TestExpectedEqual, 157 } 158 const kept = try local.core.work_dir.openFile(io, "keep.txt", .{}); 159 kept.close(io); 160 const local_tip = (try local.readRef(io, evt.events_ref)) orelse return error.TestExpectedEqual; 161 162 var remote = try RemoteRepo.open(io, allocator, .{ .path = remote_path }); 163 defer remote.deinit(io, allocator); 164 const remote_tip = (try remote.readRef(io, evt.events_ref)) orelse return error.TestExpectedEqual; 165 try std.testing.expectEqualStrings(&local_tip, &remote_tip); 166 167 var start_oids = [_][local_tip.len]u8{local_tip}; 168 var commit_iter = try local.log(io, allocator, .{ .start_oids = &start_oids }); 169 defer commit_iter.deinit(); 170 var merge_commit = (try commit_iter.next(allocator)) orelse return error.TestExpectedEqual; 171 defer merge_commit.deinit(); 172 const parent_oids = merge_commit.content.commit.metadata.parent_oids orelse return error.TestExpectedEqual; 173 try std.testing.expectEqual(2, parent_oids.len); 174 175 var arena = std.heap.ArenaAllocator.init(allocator); 176 defer arena.deinit(); 177 const status = try Events.Header.local(.git, .{}, arena.allocator(), &local, io, null); 178 try std.testing.expectEqualStrings("nothing to sync", status.sync_status orelse return error.TestExpectedEqual); 179 } 180