╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ Events.zig ───────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
772 const fetch_refspec = try std.fmt.allocPrint(allocator, "+refs/heads/{s}:refs/remotes/{s}/{s}", .{ evt.events_ref.name, remote_name, evt.events_ref.name }); 773 defer allocator.free(fetch_refspec); 774 var fetch_opts = fetch_transport_opts; 775 fetch_opts.refspecs = &.{fetch_refspec}; 776 message.clearRetainingCapacity(); 777 repo.fetch(io, allocator, remote_name, fetch_opts) catch |err| { 778 if (err == error.ServerReportedError and message.written().len != 0) return try allocator.dupe(u8, message.written()); 779 return err; 780 }; 781 782 const remote_ref: rf.Ref = .{ .kind = .{ .remote = remote_name }, .name = evt.events_ref.name }; 783 const local_oid = try repo.readRef(io, evt.events_ref); 784 const remote_oid = try repo.readRef(io, remote_ref); 785 if (local_oid == null and remote_oid == null) { 786 try evt.consume(.repo, repo_kind, repo_opts, io, allocator, repo, evt.events_ref, &.{}); 787 return null; 788 } 789 if (remote_oid != null) try evt.mergeEvents(repo_kind, repo_opts, io, allocator, repo, remote_ref); 790 try evt.consume(.repo, repo_kind, repo_opts, io, allocator, repo, evt.events_ref, &.{}); 791 792 const push_refspec = try std.fmt.allocPrint(allocator, "refs/heads/{s}:refs/heads/{s}", .{ evt.events_ref.name, evt.events_ref.name }); 793 defer allocator.free(push_refspec); 794 message.clearRetainingCapacity(); 795 repo.push(io, allocator, remote_name, push_refspec, false, push_transport_opts) catch |err| { 796 if (err == error.ServerReportedError and message.written().len != 0) return try allocator.dupe(u8, message.written()); 797 return err; 798 }; 799 message.clearRetainingCapacity(); 800 repo.fetch(io, allocator, remote_name, fetch_opts) catch |err| { 801 if (err == error.ServerReportedError and message.written().len != 0) return try allocator.dupe(u8, message.written()); 802 return err; 803 }; 804 }, 805 } 806 }, 807 } 808 return null; 809 } 810