IF Commons GitHub

logical/history

Written to: 1 requirement: 0 proved, 0 partly, 0 failing, 1 with no test recorded. 0007-repoctl-hygiene FR-007

The identity of the merge commits of a history (commons repoctl 0007-repoctl-hygiene FR-007): a merge made by a git pull where no user.name and user.email were set takes the identity of the machine or the session, and the history then credits another name. The check is pure: it reads the merges as data (git log --merges gives one line for each) and the identity and the held list of the configuration, and gives the findings; history is never rewritten, so a merge that was made wrongly is held by its hash and the held list only shrinks (a held hash that matches no merge is a warning).

import { identityFindings, parseMerges } from "./history.ts";
identityFindings(parseMerges(""), { name: "A B", email: "a@example.test" }, []); // []

Source: commons/repoctl/src/logical/history.ts

0 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.

logical.MERGE_LOGconstno test imports it
const MERGE_LOG: readonly string[]

The git log arguments that give one line for each merge: the hash, the author's name and address and the committer's name and address, separated by tabs.

logical.MergeFacttypeno test imports it
type MergeFact = { readonly hash: string; readonly author: Identity; readonly committer: Identity };

One merge commit of the history, as git log says it.

logical.parseMergesfunctionno test imports it
function parseMerges(output: string): readonly MergeFact[]

The merges of the output of MERGE_LOG; a line that is not five fields is left out.

logical.identityFindingsfunctionno test imports it
function identityFindings(merges: readonly MergeFact[], identity: Identity, held: readonly string[]): readonly HygieneFinding[]

The findings of the merges against the identity: one for each merge not made by it and not held, and a warning for each held hash that matches no merge.

MERGE_LOGconstno test imports it
const MERGE_LOG: readonly string[]

The git log arguments that give one line for each merge: the hash, the author's name and address and the committer's name and address, separated by tabs.

MergeFacttypeno test imports it
type MergeFact = { readonly hash: string; readonly author: Identity; readonly committer: Identity };

One merge commit of the history, as git log says it.

parseMergesfunctionno test imports it
function parseMerges(output: string): readonly MergeFact[]

The merges of the output of MERGE_LOG; a line that is not five fields is left out.

identityFindingsfunctionno test imports it
function identityFindings(merges: readonly MergeFact[], identity: Identity, held: readonly string[]): readonly HygieneFinding[]

The findings of the merges against the identity: one for each merge not made by it and not held, and a warning for each held hash that matches no merge.

Titles, headings, exports, tables, columns and requirements. Esc closes.