╭ changed ──╮ │src/try.zig│ ╰───────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭───────────────────────────────────────╮ │11 const rp = xit.repo; │ │12 const hash = xit.hash; │ │13 const obj = xit.object; │ │14 +const rf = xit.ref; │ │15 +const bch = xit.branch; │ │16 const ui = hx.ui; │ │17 const find = hx.find; │ │18 const srch_cmmt = hx.search_commit;│ ╰───────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1364 const opts: rp.RepoOpts(.xit) = .{}; │ │1365 var moment = try DB.HashMap(.read_write).init(cursor.*); │ │1366 const state = Repo.State(.read_write){ .core = ctx.core, .extra = .{ .moment = &moment } };│ │1367 + var arena = std.heap.ArenaAllocator.init(ctx.allocator); │ │1368 + defer arena.deinit(); │ │1369 + const aa = arena.allocator(); │ │1370 │ │1371 // a null tree keeps the parent's content, so the branch advances │ │1372 // without the fixture having to build one │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1368 - const author_line = try std.fmt.allocPrint(ctx.allocator, "{s} <{s}>", .{ ctx.author.name, ctx.author.email }); │ │1369 - defer ctx.allocator.free(author_line); │ │1370 - _ = try obj.writeCommit(.xit, opts, state, ctx.io, ctx.allocator, .{ │ │1373 + const author_line = try std.fmt.allocPrint(aa, "{s} <{s}>", .{ ctx.author.name, ctx.author.email }); │ │1374 + const feature_old = (try rf.readRecur(.xit, opts, state.readOnly(), ctx.io, .{ .ref = .{ .kind = .head, .name = "feature" } })) orelse return error.NotFound;│ │1375 + const feature_new = try obj.writeCommit(.xit, opts, state, ctx.io, ctx.allocator, .{ │ │1376 .message = "Revise the feature branch", │ │1377 .author = author_line, │ │1378 .timestamp = 820, │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1379 }, null, .{ .kind = .head, .name = "feature" }); │ │1380 │ │1376 - _ = try pch.refreshBranchesInTransaction(.server, opts, state, &moment, ctx.io, ctx.allocator, null, null, null); │ │1377 - try push.writeUndo(opts, state, ctx.io, ctx.allocator, ctx.author); │ │1381 + // a branch the push creates has no old tip, so its range is open │ │1382 + try bch.add(.xit, opts, state, ctx.io, .{ .name = "docs" }); │ │1383 + const docs_new = (try rf.readRecur(.xit, opts, state.readOnly(), ctx.io, .{ .ref = .{ .kind = .head, .name = "docs" } })) orelse return error.NotFound;│ │1384 + │ │1385 + const updates = [_]xit.net_server_receive_pack.AppliedRefUpdate{ │ │1386 + .{ │ │1387 + .ref_name = try aa.dupe(u8, "refs/heads/feature"), │ │1388 + .old_oid = try aa.dupe(u8, &feature_old), │ │1389 + .new_oid = try aa.dupe(u8, &feature_new), │ │1390 + }, │ │1391 + .{ │ │1392 + .ref_name = try aa.dupe(u8, "refs/heads/docs"), │ │1393 + .old_oid = try aa.dupe(u8, "0" ** hash.hexLen(opts.hash)), │ │1394 + .new_oid = try aa.dupe(u8, &docs_new), │ │1395 + }, │ │1396 + }; │ │1397 + │ │1398 + _ = try pch.refreshBranchesInTransaction(.server, opts, state, &moment, ctx.io, ctx.allocator, &updates, null, null); │ │1399 + try push.writeUndo(opts, state, ctx.io, ctx.allocator, ctx.author, &updates); │ │1400 } │ │1401 }; │ │1402 │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯