Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0002-anyfs-githost-store FR-001
Who a commit is by and what its message says, as values a program sets and never as the configuration of a computer: an identity made only by its parser, a trailer made only by its parser, and a message made by a function of what the commit changes (the default says it in a line), with the trailers after a blank line.
import { parseIdentity, parseTrailer, messageOf, defaultSubject } from "./identity.ts" ;
const who = parseIdentity ("collector" , "collector@localhost" );
const t = parseTrailer ("Refs" , "#21" );
who.kind === "ok" && t.kind === "ok" && messageOf (defaultSubject, [{ kind: "put" , path: "a/b" }], [t.value]); // "anyfs: write a/b\n\nRefs: #21\n" Source: commons/anyfs-githost/src/governance/identity.ts
4 of 8 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.
Changedtype no test imports it type Changed =
| { readonly kind : "put" ; readonly path : string }
| { readonly kind : "delete" ; readonly path : string }
| { readonly kind : "move" ; readonly path : string ; readonly to : string };What one change of a commit was, for the message.
const defaultSubject : Subject The subject the library makes where none is given: one line saying the change, or the number of changes.
Imported by 2 tests of the run (2 passed, 0 failed): the library's results
Identitytype no test imports it type Identity = Brand <{ readonly name : string ; readonly email : string }, "anyfs githost identity" >;A name and an address that a commit is by. Made only by parseIdentity.
function messageOf (subject : Subject , changes : readonly Changed [], trailers : readonly Trailer []): string A message: the subject, and for a commit of several changes a line for each, then the trailers after a blank line, and a line ending.
Imported by 2 tests of the run (2 passed, 0 failed): the library's results
function parseIdentity (name : string , email : string ): Result <Identity , string >An identity from a name and an address, or why they are not one: each is one line with no angle bracket, and the address holds an @.
Imported by 2 tests of the run (2 passed, 0 failed): the library's results
function parseTrailer (key : string , value : string ): Result <Trailer , string >A trailer from a key and a value, or why they are not one: a key of letters, digits and hyphens that starts with a letter, and a value of one line.
Imported by 2 tests of the run (2 passed, 0 failed): the library's results
Subjecttype no test imports it type Subject = (changes : readonly Changed []) => string ;How the first line of a message is made from what a commit changes: a function a program writes.
Trailertype no test imports it type Trailer = Brand <{ readonly key : string ; readonly value : string }, "anyfs githost trailer" >;A line at the end of a message: Key: value. Made only by parseTrailer.