code wiki / _hdl_build / nx_sovgit_git.nx

nx_sovgit_git.nx

buildroot/runtime/_hdl_build/nx_sovgit_git.nx

94430 B1843 linesdepth 9pulls 22 transitivereach 0 importersview sourcekind tooltopic sovgit
docsdependenciesstructsconstsfunctions

about

nx_sovgit_git.nx -- ★SOVGIT X2: SOVEREIGN MULTI-REPO SMART-HTTP git host on nx_http_server sockets, NO nginx/framework. v0 smart protocol (pkt-line advert + upload-pack pack stream + receive-pack push), multi-repo routed by path (/git/<repo>/...), push-to-create, multi-ref push, HEAD symref advert. Legacy single-repo paths (/git/info/refs) keep serving knowledge/_sovgit_repo (back-compat, X1 demo). SCALE ENVELOPE (declared in banner, guarded in code -- fail LOUD, never a corrupt pack): push request <= REQ cap (128 MiB buffer; the TLS edge proxies bodies <= ~2 MiB today = the wire cap, so an over-edge push must stay small -- incremental packs keep beats tiny; big seeds go loopback) clone pack <= PACK cap (128 MiB; overflow -> 500, never truncated silently) one object <= 64 MiB inflated branch names: single-level refs/heads/<name> (no '/' subdirs yet); ref deletes: unsupported (ng) Buffers are allocated ONCE in main and reused per request (bounded-VSZ discipline). Reuses X0 (objects/sha/zlib) + X1b/X1d (pack gen/parse). license_tier: ORIGINAL

dependencies 3 imports · 0 importers

nx_sovgit_obj.nx nx_http_server.nx nx_login_gate.nx nx_sovgit_git.nx

imports: nx_sovgit_obj.nxnx_http_server.nxnx_login_gate.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main seq sstrlen sstrlen ↻ sg_pathgate_selftest lg pg_lit pg_case sg_name_portable sg_ieq sstrlen ↻ sg_lc sg_lc ↻ lg ↻ lgn sys_munmap sstrlen ↻ pg_case ↻ scopy sg_tree_names_ok sg_name_portable ↻ lgn ↻ assemble_repo scopy ↻ read_ref_at rr_path scopy ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap sys_read sys_close sys_munmap ↻ lg ↻ sys_mkdir sg_write_loose sg_oid_hex sys_mmap ↻ sg_oid_raw

structs

none

consts

16const K_MAGIC_65536: i64 = 65536
17const K_MAGIC_4096: i64 = 4096
18const K_MAGIC_1024: i64 = 1024
19const K_MAGIC_2048: i64 = 2048
20const K_MAGIC_8192: i64 = 8192
21const K_MAGIC_18691: i64 = 18691
26const CH_LF: i64 = 10
27const CH_SP: i64 = 32
28const CH_DQUOTE: i64 = 34
29const CH_PCT: i64 = 37
30const CH_AMP: i64 = 38
31const CH_STAR: i64 = 42
32const CH_PLUS: i64 = 43
33const CH_DOT: i64 = 46
34const CH_SLASH: i64 = 47
35const CH_0: i64 = 48
36const CH_9: i64 = 57
37const CH_COLON: i64 = 58
38const CH_LT: i64 = 60
39const CH_GT: i64 = 62
40const CH_QUERY: i64 = 63
41const CH_A_UP: i64 = 65
42const CH_F_UP: i64 = 70
43const CH_Z_UP: i64 = 90
44const CH_BSLASH: i64 = 92
45const CH_A_LO: i64 = 97
46const CH_F_LO: i64 = 102
47const CH_PIPE: i64 = 124
48const CH_DEL: i64 = 127
49const HEX_BASE: i64 = 16
50const CASE_DELTA: i64 = 32
51const HEXA_LO_ADJ: i64 = 87
52const HEXA_UP_ADJ: i64 = 55
53const NAME_MAX: i64 = 255

functions

55func lg(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(2, s, n); return 0 }
56func lgn(v: i64) -> i64
69func sstrlen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
70func scopy(dst: *u8, at: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { dst[at + i] = s[i]; i = i + 1 } return at + i }
71func udec(out: *u8, at: i64, v: i64) -> i64
77func wfile(path: *u8, buf: *u8, n: i64) -> i64 { let fd: i64 = sys_openat_wr(path, 0x1a4); if fd < 0 { return 0 - 1 } sys_write(fd, buf, n); sys_close(fd); return 0 }
78func wstr(path: *u8, s: *u8) -> i64 { return wfile(path, s, sstrlen(s)) }
80func pcontains(p: *u8, plen: i64, needle: *u8) -> i64
93func seq(a: *u8, alen: i64, b: *u8) -> i64
102func hex4(out: *u8, at: i64, v: i64) -> i64
112func pkt(out: *u8, at: i64, payload: *u8, plen: i64) -> i64
117func pkts(out: *u8, at: i64, s: *u8) -> i64 { return pkt(out, at, s, sstrlen(s)) }
118func pktflush(out: *u8, at: i64) -> i64 { out[at] = 48 as u8; out[at + 1] = 48 as u8; out[at + 2] = 48 as u8; out[at + 3] = 48 as u8; return at + 4 }
120func rd_hex4(b: *u8, at: i64) -> i64
called by 1: serve_receivepack
134func be32w(out: *u8, at: i64, v: i64) -> i64 { out[at] = ((v >> 24) & 255) as u8; out[at + 1] = ((v >> 16) & 255) as u8; out[at + 2] = ((v >> 8) & 255) as u8; out[at + 3] = (v & 255) as u8; return at + 4 }
called by 1: pack_disk
135func pk_objhdr(out: *u8, at: i64, typ: i64, size: i64) -> i64
called by 1: pk_object
140func pk_object(out: *u8, at: i64, typ: i64, content: *u8, clen: i64) -> i64
called by 1: pack_disk calls 2: pk_objhdrsg_zwrap
154func sg_lc(c: i64) -> i64 { if c >= CH_A_UP { if c <= CH_Z_UP { return c + CASE_DELTA } } return c }
155func sg_ieq(nm: *u8, nl: i64, lit: *u8) -> i64
called by 1: sg_name_portable calls 2: sstrlensg_lc
162func sg_name_portable(nm: *u8, nl: i64) -> i64
called by 2: sg_tree_names_okpg_case calls 2: sg_ieqsg_lc
210func sg_tree_names_ok(t: *u8, tlen: i64, oidlen: i64) -> i64
240func unpack_into(objroot: *u8, pack: *u8, plen: i64) -> i64
290func sg_ishex(c: i64) -> i64
called by 2: pack_diskch_decode
296func sg_namelen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
297func repo_char_ok(c: i64) -> i64
called by 2: ref_okparse_repo
306func ref_ok(r: *u8) -> i64
330func parse_repo(path: *u8, plen: i64, segout: *u8, rest_off: *i64) -> i64
called by 1: serve calls 2: seqrepo_char_ok
377func repo_root(dst: *u8, seg: *u8, seglen: i64) -> i64
called by 1: serve calls 1: scopy
386func rr_path(dst: *u8, root: *u8, rel: *u8) -> i64
393func repo_exists(root: *u8) -> i64
called by 1: serve
400func ensure_repo(root: *u8) -> i64
419func read_ref_at(root: *u8, refrel: *u8, hexout: *u8) -> i64
440func head_target(root: *u8, tgt: *u8) -> i64
478func walk_depth(root: *u8, tip: *u8, depth: i64, out: *u8, content: *u8) -> i64
506func pack_disk(root: *u8, out: *u8, outcap: i64, content: *u8, noblob: i64, allow: *u8, nallow: i64) -> i64
601func advert_body(body: *u8, bcap: i64, root: *u8, svc: i64) -> i64
686func resp_hdr(resp: *u8, ctype: *u8, blen: i64) -> i64
695func send_txt(cfd: i64, resp: *u8, status: *u8, msg: *u8) -> i64
708func serve_static(cfd: i64, root: *u8, relpath: *u8, rlen: i64, resp: *u8) -> i64
735func serve_advert(cfd: i64, resp: *u8, root: *u8, svc: i64) -> i64
747func serve_uploadpack_result(cfd: i64, resp: *u8, root: *u8, pack: *u8, packcap: i64, pbody: *u8, content: *u8) -> i64
768func v2_caps_body(body: *u8, bcap: i64) -> i64
called by 1: serve_v2_caps calls 2: pktspktflush
779func serve_v2_caps(cfd: i64, resp: *u8) -> i64
788func v2_lsrefs_body(body: *u8, bcap: i64, root: *u8) -> i64
841func sb_chunk(out: *u8, at: i64, band: i64, data: *u8, dlen: i64) -> i64
called by 1: serve_v2_fetch calls 1: hex4
852func serve_bundle(cfd: i64, resp: *u8, root: *u8, pack: *u8, packcap: i64, pbody: *u8, content: *u8) -> i64
875func serve_v2_bundleuri(cfd: i64, resp: *u8, pbody: *u8, seg: *u8, sl: i64) -> i64
912func serve_openapi(cfd: i64, resp: *u8, pbody: *u8) -> i64
933func serve_oplog(cfd: i64, resp: *u8, pbody: *u8) -> i64
963func serve_ci(cfd: i64, resp: *u8, pbody: *u8) -> i64
996func hexv1(c: i64) -> i64
1004func ui_row(pbody: *u8, b0: i64, buf: *u8, st: i64, en: i64) -> i64
1027func serve_forge_log(cfd: i64, resp: *u8, root: *u8, pbody: *u8, body: *u8, blen: i64, fname: *u8, heading: *u8, rowtag: *u8, formhtml: *u8) -> i64
1086func serve_issues(cfd: i64, resp: *u8, root: *u8, pbody: *u8, seg: *u8, sl: i64, body: *u8, blen: i64) -> i64
1139func ui_esc(pbody: *u8, b: i64, c: i64) -> i64
1146func serve_ui(cfd: i64, resp: *u8, root: *u8, pbody: *u8, seg: *u8, sl: i64, rest: *u8, rlen: i64) -> i64
1295func serve_v2_lsrefs(cfd: i64, resp: *u8, root: *u8, pbody: *u8) -> i64
1302func serve_v2_fetch(cfd: i64, resp: *u8, root: *u8, pack: *u8, packcap: i64, pbody: *u8, content: *u8, noblob: i64, body: *u8, blen: i64) -> i64
1378func serve_receivepack(cfd: i64, body: *u8, blen: i64, resp: *u8, root: *u8) -> i64
1552func ch_decode(src: *u8, n: i64, out: *u8, outcap: i64) -> i64
1599func serve(cfd: i64, path: *u8, plen: i64, body: *u8, blen: i64, resp: *u8, pack: *u8, packcap: i64, pbody: *u8, content: *u8, v2: i64) -> i64
1644func assemble_repo(chex_out: *u8) -> i64
1675func send_401(cfd: i64, resp: *u8) -> i64
1693func pg_case(nm: *u8, nl: i64, want: i64, label: *u8, fails: *i64) -> i64
1699func pg_lit(s: *u8, want: i64, fails: *i64) -> i64 { return pg_case(s, sstrlen(s), want, s, fails) }
1700func sg_pathgate_selftest() -> i64
1756func main(argc: i64, argv: *i64) -> i64