╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ ui.zig ───────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
366 try evt.consume(.local, .repo, .git, .{}, io, allocator, &local, evt.events_ref, &.{.{ 367 .id = std.fmt.bytesToHex(id, .lower), 368 .author = .{ .name = "haxy", .email = "user@haxy" }, 369 .event = .{ .issue = .{ .title = "local", .description = "", .labels = "" } }, 370 }}); 371 } 372 { 373 var remote = try RemoteRepo.open(io, allocator, .{ .path = remote_path }); 374 defer remote.deinit(io, allocator); 375 const id = [_]u8{3} ** evt.event_id_size; 376 try evt.consume(.local, .repo, .git, .{}, io, allocator, &remote, evt.events_ref, &.{.{ 377 .id = std.fmt.bytesToHex(id, .lower), 378 .author = .{ .name = "haxy", .email = "user@haxy" }, 379 .event = .{ .issue = .{ .title = "remote", .description = "", .labels = "" } }, 380 }}); 381 } 382 try std.testing.expectEqual(null, try Events.sync(io, allocator, .{ .path = local_path, .repo_kind = .git })); 383 { 384 var local = try Repo.open(io, allocator, .{ .path = local_path }); 385 defer local.deinit(io, allocator); 386 try local.removeBranch(io, .{ .name = evt.events_ref.name }); 387 try evt.consume(.local, .repo, .git, .{}, io, allocator, &local, evt.events_ref, &.{}); 388 } 389 try std.testing.expectEqual(null, try Events.sync(io, allocator, .{ .path = local_path, .repo_kind = .git })); 390 391 var local = try Repo.open(io, allocator, .{ .path = local_path }); 392 defer local.deinit(io, allocator); 393 var head_buffer: [xit.ref.MAX_REF_CONTENT_SIZE]u8 = undefined; 394 const head = try local.head(io, &head_buffer); 395 switch (head) { 396 .ref => |ref| try std.testing.expectEqualStrings("master", ref.name), 397 .oid => return error.TestExpectedEqual, 398 } 399 const kept = try local.core.work_dir.openFile(io, "keep.txt", .{}); 400 kept.close(io); 401 const local_tip = (try local.readRef(io, evt.events_ref)) orelse return error.TestExpectedEqual; 402 403 var remote = try RemoteRepo.open(io, allocator, .{ .path = remote_path }); 404 defer remote.deinit(io, allocator); 405 const remote_tip = (try remote.readRef(io, evt.events_ref)) orelse return error.TestExpectedEqual; 406 try std.testing.expectEqualStrings(&local_tip, &remote_tip); 407 408 var start_oids = [_][local_tip.len]u8{local_tip}; 409 var commit_iter = try local.log(io, allocator, .{ .start_oids = &start_oids }); 410 defer commit_iter.deinit(); 411 var merge_commit = (try commit_iter.next(allocator)) orelse return error.TestExpectedEqual; 412 defer merge_commit.deinit(); 413 const parent_oids = merge_commit.content.commit.metadata.parent_oids orelse return error.TestExpectedEqual; 414 try std.testing.expectEqual(2, parent_oids.len); 415 416 var arena = std.heap.ArenaAllocator.init(allocator); 417 defer arena.deinit(); 418 const status = try Events.Header.local(.git, .{}, arena.allocator(), &local, io, null); 419 try std.testing.expectEqualStrings("nothing to sync", status.sync_status orelse return error.TestExpectedEqual); 420 } 421