interplane.Get Omega
Read in your language

interplane-forge

INTERPLANE Forge

Brought by drakestapleton

branch main Branches Tags History

interplane-forge / nodes / head.om

81 lines · 1830 bytes Raw Blame History
1note nodes/head.om: the default branch of the current repository (frid), read straight from the HEAD
2note file of its Radicle storage instead of starting `git symbolic-ref` (README host dependency 1,
3note git: this is the first git call moved into Omega; browse brdefref and dl dldefbr use it).
4note "ref: refs/heads/<name>" plus a newline gives <name>. Anything else gives no name and the callers
5note fall back to "main", as they did when git failed: a detached HEAD (a bare commit id), a ref
6note outside refs/heads/, an unreadable or oversized file, or a name git would refuse (a byte outside
7note A-Z a-z 0-9 . _ - / +, a leading - / ., a trailing / ., "..", "//" or "/."). Parity with git
8note across every public repository and the fixtures: nodes/tests/ab.sh check.
9text tnshead "/HEAD"
10text tnsrefh "ref: refs/heads/"
11global nshb uchar 256
12global nshbl ulong 1
13fn nshok c uchar to bool
14if and ge c 48 le c 57
15ret true
16end
17if and ge c 97 le c 122
18ret true
19end
20if and ge c 65 le c 90
21ret true
22end
23if or eq c 46 eq c 95
24ret true
25end
26if or eq c 45 eq c 47
27ret true
28end
29ret eq c 43
30end
31note nshead: true with the branch name in nshb[0, nshbl) when HEAD names a branch (clobbers fxo)
32fn nshead to bool
33put nshbl 0 0
34fpb
35fpt tfstore
36for i ulong get fridl 0 bound 64
37fpc get frid i
38end
39fpt tnshead
40n = frdall
41if le n 0
42ret false
43end
44ln = get fxol 0
45a = len tnsrefh
46if or lt ln add a 2 gt ln add a 201
47ret false
48end
49for i ulong a
50if ne get fxo i get tnsrefh i
51ret false
52end
53end
54if ne get fxo sub ln 1 10
55ret false
56end
57k = sub sub ln 1 a
58p = uchar 47
59for i ulong k bound 200
60c = get fxo add a i
61if not nshok c
62ret false
63end
64if and eq c 46 or eq p 46 eq p 47
65ret false
66end
67if and eq c 47 eq p 47
68ret false
69end
70if and eq i 0 eq c 45
71ret false
72end
73put nshb i c
74p = c
75end
76if or eq p 47 eq p 46
77ret false
78end
79put nshbl 0 k
80ret true
81end