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