code wiki / _hdl_build / nx_sovgit_push.nx
nx_sovgit_push.nx
buildroot/runtime/_hdl_build/nx_sovgit_push.nx
about
nx_sovgit_push.nx -- ★SOVGIT F222: the SOVEREIGN GIT PUSHER. Snapshots a working tree and pushes it to a
sovgit host speaking the git receive-pack CLIENT wire, with ZERO /usr/bin/git anywhere in the path.
This is the no-git-law end-state for the replication leg: walk -> X0 sha256 objects -> X1b packfile ->
pkt-line ref-update + pack over HTTP -> report-status. The ark's crash-durability beat becomes sovereign.
WHY A SNAPSHOT (not a git-history mirror): stock git CANNOT push a sha1 repo to a sha256 remote (no interop),
so the sovereign leg re-frames the working tree as sha256 objects. Each push chains a commit onto the remote
ref (parent = the advertised old sha) so history is preserved additively (rule 13) -- exactly the ark's job.
SCALE ENVELOPE (declared in output, guarded in code, fail LOUD -- never a silent partial snapshot):
entries per directory <= 20000 name bytes per directory <= 2 MiB tree depth <= 32
single file <= 64 MiB pack <= 128 MiB path <= 4096
skipped by design: .git, symlinks + special files, and SECRET MATERIAL (deny-by-construction:
secret/passw/token/credential/.pem/.cap/.key/_key(s)/privkey/id_rsa/id_ed25519/_seed.bin/opaque)
-- every exclusion is COUNTED and NAMED on stderr, never silently dropped
⚠the SERVER's request envelope also binds (nx_sovgit_git req buffer); a push above it is refused there.
Transport rung 1 = loopback TCP (127.0.0.1:<port>) -- the daemon is wall-only by design; the TLS/edge
transport for off-box pushes is the sibling rung (compose mcl_req-class primitives).
license_tier: ORIGINAL
dependencies 11 imports · 0 importers
diagram shows first 10 each side; +1 more imports, +0 more importers in the complete lists below.
imports: nx_sovgit_obj.nxnx_connect.nxnx_acme_http.nxnx_https_url_for_fetch.nxnx_https_url_connect.nxnx_tls13_client_session_run.nxnx_tls13_client_session.nxnx_tls13.nxnx_tls13_record.nxnx_tls13_read_record_from_fd.nxnx_csprng.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 33 | const SGP_MAGIC_131072: i64 = 131072 |
| 34 | const SGP_MAGIC_61440: i64 = 61440 |
| 35 | const SGP_MAGIC_16384: i64 = 16384 |
| 36 | const SGP_MAGIC_32768: i64 = 32768 |
| 37 | const SGP_MAGIC_16645: i64 = 16645 |
| 38 | const SGP_MAGIC_2048: i64 = 2048 |
| 39 | const SGP_MAGIC_18691: i64 = 18691 |
| 40 | const SGP_MAGIC_4194304: i64 = 4194304 |
| 41 | const SGP_MAGIC_8192: i64 = 8192 |
| 42 | const SGP_MAGIC_1024: i64 = 1024 |
| 43 | const SGP_MAGIC_65536: i64 = 65536 |
| 44 | const SGP_MAGIC_4096: i64 = 4096 |
| 51 | const SGP_EDGE_SAFE: i64 = 1400000 |
| 52 | const SGP_MAX_OBJ: i64 = 200000 |
| 53 | const SGP_HS_SIZE: i64 = 524288 |
| 54 | const SGP_MAX_ENT: i64 = 20000 |
| 55 | const SGP_NAMEARENA: i64 = 2097152 |
| 56 | const SGP_MAX_DEPTH: i64 = 32 |
| 57 | const SGP_MAX_FILE: i64 = 67108864 |
| 58 | const SGP_PACK_CAP: i64 = 134217728 |
| 59 | const SGP_PATHBUF: i64 = 4096 |
| 60 | const SGP_RESP: i64 = 65536 |
functions
| 63 | func sgp_w(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } called by 1: main |
| 64 | func sgp_we(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(2, s, n); return 0 } |
| 65 | func sgp_wn(v: i64) -> i64 calls 1: sys_munmap |
| 78 | func sgp_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 79 | func sgp_cat(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 } |
| 80 | func sgp_dec(out: *u8, at: i64, v: i64) -> i64 |
| 92 | func sgp_atoi(s: *u8) -> i64 called by 1: main |
| 102 | func sgp_streq(a: *u8, b: *u8) -> i64 called by 1: sgp_walk |
| 120 | func sgp_lc(c: i64) -> i64 { if c >= 65 { if c <= 90 { return c + 32 } } return c } called by 1: sgp_needle_ci |
| 121 | func sgp_needle_ci(name: *u8, needle: *u8) -> i64 |
| 140 | func sgp_load_ignore(srcdir: *u8, ibuf: *u8, icap: i64, pst: *i64) -> i64 |
| 189 | func sgp_is_ignored(name: *u8, pst: *i64) -> i64 |
| 208 | func sgp_is_doc_ext(name: *u8) -> i64 |
| 216 | func sgp_is_secret(name: *u8) -> i64 |
| 235 | func sgp_isdots(nm: *u8) -> i64 called by 1: sgp_walk |
| 243 | func sgp_join(buf: *u8, base: i64, name: *u8) -> i64 called by 1: sgp_walk |
| 252 | func sgp_u32(b: *u8, at: i64) -> i64 called by 1: sgp_walk |
| 258 | func sgp_read_file(path: *u8, out_len: *i64) -> *u8 |
| 281 | func sgp_be32(out: *u8, at: i64, v: i64) -> i64 |
| 288 | func sgp_objhdr(out: *u8, at: i64, typ: i64, size: i64) -> i64 called by 1: sgp_pack_add |
| 297 | func sgp_pack_begin(pack: *u8, pst: *i64) -> i64 calls 1: sgp_be32 |
| 307 | func sgp_pack_add(pack: *u8, pst: *i64, typ: i64, content: *u8, clen: i64) -> i64 |
| 324 | func sgp_hs_hash(sha: *u8, mask: i64) -> i64 |
| 330 | func sgp_hs_build(shas: *u8, n: i64, table: *i64, tsize: i64) -> i64 calls 1: sgp_hs_hash |
| 346 | func sgp_hs_has(shas: *u8, table: *i64, tsize: i64, q: *u8) -> i64 |
| 364 | func sgp_havepath(dst: *u8, repo: *u8, ref: *u8) -> i64 calls 1: sgp_cat |
| 377 | func sgp_emit(pack: *u8, pst: *i64, typ: i64, content: *u8, clen: i64, raw32: *u8, allshas: *u8, hshas: *u8, htab: *i64) -> i64 |
| 386 | func sgp_pack_end(pack: *u8, pst: *i64) -> i64 |
| 397 | func sgp_chr(s: *u8, n: i64, isdir: i64, i: i64) -> i64 called by 1: sgp_keycmp |
| 402 | func sgp_keycmp(a: *u8, an: i64, ad: i64, b: *u8, bn: i64, bd: i64) -> i64 |
| 417 | func sgp_entcmp(arena: *u8, noff: *i64, nlen: *i64, isdir: *i64, x: i64, y: i64) -> i64 |
| 423 | func sgp_msort(arena: *u8, noff: *i64, nlen: *i64, isdir: *i64, idx: *i64, aux: *i64, n: i64) -> i64 |
| 459 | func sgp_walk(path: *u8, plen: i64, pack: *u8, pst: *i64, depth: i64, out_sha32: *u8, out_ecount: *i64, stats: *i64, allshas: *u8, hshas: *u8, htab: *i64) -> i64 |
| 597 | func sgp_connect(port: i64) -> i64 |
| 612 | func sgp_write_all(fd: i64, buf: *u8, n: i64) -> i64 |
| 621 | func sgp_drain(fd: i64, buf: *u8, cap: i64) -> i64 |
| 633 | func sgp_build_req(out: *u8, method: *u8, path: *u8, host: *u8, capstr: *u8, ct: *u8, body: *u8, blen: i64) -> i64 |
| 657 | func sgp_http(port: i64, req: *u8, reqlen: i64, out: *u8, outcap: i64) -> i64 |
| 670 | func sgp_tls_send_drain(s: *Tls13ClientSession, fd: i64, req: *u8, req_len: i64, out: *u8, out_cap: i64) -> i64 |
| 731 | func sgp_https(store: *TrustStore, url: *u8, req: *u8, reqlen: i64, out: *u8, outcap: i64) -> i64 |
| 761 | func sgp_xfer_once(mode: i64, port: i64, store: *TrustStore, urlbase: *u8, path: *u8, req: *u8, reqlen: i64, out: *u8, outcap: i64) -> i64 |
| 776 | func sgp_xfer(mode: i64, port: i64, store: *TrustStore, urlbase: *u8, path: *u8, req: *u8, reqlen: i64, out: *u8, outcap: i64) -> i64 |
| 805 | func sgp_dump(buf: *u8, n: i64, want: i64) -> i64 |
| 812 | func sgp_find(hay: *u8, hn: i64, needle: *u8) -> i64 calls 1: sgp_slen |
| 825 | func sgp_find_ref(buf: *u8, n: i64, refpath: *u8, out64: *u8) -> i64 |
| 857 | func main(argc: i64, argv: *i64) -> i64 |