clone

a personal forge on plain git: static pages, stacked-diff reviews, signed local ci, repo sites and releases

main
forge / test / scenarios / log-columns.sh
log-columns.sh 2.6K
1# The log shows Jev's answers about each commit in columns: its type on the2# left, its risk as the score Jev gave (0 to 3, one decimal, colored from3# moderate up), and a mark after the subject when the message may not4# describe the diff. A repo without answers has neither column.5. "$(dirname "$0")/../lib.sh"6user dami7repo dami/greet8clone dami dami/greet "$T/w/d"9at "$T/w/d" commit "plain"10at "$T/w/d" commit "add a greeting"11at "$T/w/d" commit "fix the wave"12push_as dami "$T/w/d" origin main13export FORGE_STRICT=114build dami/greet15lacks "$FORGE_WWW/dami/greet/log/main/index.html" '<th class="kind">'16g=$FORGE_ROOT/dami/greet.git17# Stored answers, keyed the way the build looks them up.18answer() { # sha kind risk matches19 node -e '20 const [gitDir, sha, kind, risk, matches] = process.argv.slice(1);21 import(process.cwd() + "/lib/jev-commits.ts").then(({ patchIds, commitKey }) => {22 const fs = require("fs"), cp = require("child_process");23 const subject = cp.execFileSync("git", ["--git-dir=" + gitDir, "log", "-1", "--format=%s", sha], { encoding: "utf8" }).trim();24 const key = commitKey(patchIds(gitDir, [sha]).get(sha), subject, "", 1);25 fs.mkdirSync(gitDir + "/forge/jev/commit.v1", { recursive: true });26 fs.writeFileSync(gitDir + "/forge/jev/commit.v1/" + key, JSON.stringify({ model: "test", at: 1, tokens: null, answers: {27 kind: { type: "choice", choice: kind }, risk: { type: "score", score: Number(risk) }, matches: { type: "noul", noul: Number(matches) } } }));28 });' "$g" "$1" "$2" "$3" "$4"29}30(cd "$T_HOME" && answer "$(git --git-dir="$g" rev-parse main~1)" feat 0.44 0.9)31(cd "$T_HOME" && answer "$(git --git-dir="$g" rev-parse main)" fix 2.43 0.05)32rm -f "$FORGE_CACHE/repos/dami/greet.json"33build dami/greet34p=$FORGE_WWW/dami/greet/log/main/index.html35has "$p" '<th class="kind">type</th><th>commit</th>'36has "$p" '<td class="kind"><span class="jev-kind feat"[^>]*>feat</span></td><td class="main"><a [^>]*>add a greeting</a></td>'37has "$p" '<td class="kind"><span class="jev-kind fix"[^>]*>fix</span></td><td class="main"><a [^>]*>fix the wave</a> <span class="jev-mismatch"'38has "$p" '<td class="num risk"><span class="jev-score" title="risk score 0.4 of 3[^"]*">0.4</span></td>'39has "$p" '<td class="num risk"><span class="jev-score moderate" title="risk score 2.4 of 3[^"]*">2.4</span></td>'40# The plain commit has no answer: empty cells, not a guess.41has "$p" '<td class="kind"></td><td class="main"><a [^>]*>plain</a></td>'42has "$FORGE_WWW/dami/greet/commit/$(git --git-dir="$g" rev-parse main)/index.html" '<span class="desc">risk score</span> <span class="jev-score moderate"'