╭ changed ╮ │README.md│ ╰─────────╯ ╭───────────────────────────────────────────────────────────────────────────────╮ │19 │ │20 ``` │ │21 mkdir server │ │22 -./zig-out/bin/haxy serve --http-listen 127.0.0.1:8080 --project-root server│ │22 +./zig-out/bin/haxy serve --http-listen 127.0.0.1:8080 --data-dir server │ │23 ``` │ │24 │ │25 Then, in another terminal, do this: │ ╰───────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │35 git push origin HEAD:master │ │36 ``` │ │37 │ │38 -After that, you'll see your repo in `server/test`. It's MAGIC! Obviously, this is not very useful right now. I'm currently nailing down the git functionality before working on other things like user accounts and the UI. │ │38 +After that, you'll see your repo in `server/repos/test`. It's MAGIC! Obviously, this is not very useful right now. I'm currently nailing down the git functionality before working on other things like user accounts and the UI.│ │39 │ │40 ## The longer term vision │ │41 │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ──────╮ │src/command.zig│ ╰───────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │22 \\a long-running server forwarding receive-pack and upload-pack. │ │23 , │ │24 .example = │ │25 - \\haxy serve --http-listen 127.0.0.1:8080 --ssh-listen 127.0.0.1:8081 --project-root /srv/git│ │25 + \\haxy serve --http-listen 127.0.0.1:8080 --ssh-listen 127.0.0.1:8081 --data-dir /srv/git │ │26 , │ │27 }, │ │28 .ssh_helper => .{ │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────╮ │ 97 .{"--http-listen"}, │ │ 98 .{"--ssh-listen"}, │ │ 99 .{"--ssh-connect"}, │ │100 - .{"--project-root"},│ │100 + .{"--data-dir"}, │ │101 .{"--service"}, │ │102 }); │ │103 │ ╰─────────────────────────────────╯ ╭──────────────────────────────────────────╮ │193 serve: struct { │ │194 http_listen: []const u8, │ │195 ssh_listen: ?[]const u8, │ │196 - project_root: []const u8,│ │196 + data_dir: []const u8, │ │197 }, │ │198 ssh_helper: struct { │ │199 ssh_connect: []const u8, │ ╰──────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │210 return .{ .serve = .{ │ │211 .http_listen = (cmd_args.get("--http-listen") orelse null) orelse "127.0.0.1:8080",│ │212 .ssh_listen = (cmd_args.get("--ssh-listen") orelse null), │ │213 - .project_root = (cmd_args.get("--project-root") orelse null) orelse ".", │ │213 + .data_dir = (cmd_args.get("--data-dir") orelse null) orelse ".", │ │214 } }; │ │215 }, │ │216 .ssh_helper => { │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ───╮ │src/main.zig│ ╰────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────╮ │79 try serve.run(repo_kind, any_repo_opts, io, allocator, cwd_path, .{│ │80 .http_listen = cli_cmd.serve.http_listen, │ │81 .ssh_listen = cli_cmd.serve.ssh_listen, │ │82 - .project_root = cli_cmd.serve.project_root, │ │82 + .data_dir = cli_cmd.serve.data_dir, │ │83 }, run_opts.err); │ │84 }, │ │85 .ssh_helper => { │ ╰───────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ────╮ │src/serve.zig│ ╰─────────────╯ ╭──────────────────────────────────╮ │ 6 pub const Options = struct { │ │ 7 http_listen: []const u8, │ │ 8 ssh_listen: ?[]const u8, │ │ 9 - project_root: []const u8, │ │ 9 + data_dir: []const u8, │ │10 }; │ │11 │ │12 const ListenAddress = struct {│ ╰──────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────╮ │23 options: Options, │ │24 err: *std.Io.Writer, │ │25 ) !void { │ │26 - const project_root = try std.fs.path.resolve(allocator, &.{ cwd_path, options.project_root });│ │27 - defer allocator.free(project_root); │ │26 + const data_dir = try std.fs.path.resolve(allocator, &.{ cwd_path, options.data_dir }); │ │27 + defer allocator.free(data_dir); │ │28 + const repo_root = try std.fs.path.resolve(allocator, &.{ data_dir, "repos" }); │ │29 + defer allocator.free(repo_root); │ │30 + │ │31 + try std.Io.Dir.cwd().createDirPath(io, repo_root); │ │32 │ │33 if (options.ssh_listen) |ssh_listen| { │ │34 const HttpContext = struct { │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────╮ │35 io: std.Io, │ │36 allocator: std.mem.Allocator,│ │33 - project_root: []const u8, │ │37 + repo_root: []const u8, │ │38 http_listen: []const u8, │ │39 err: *std.Io.Writer, │ │40 │ ╰─────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯