IF Commons GitHub

git

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0001-githost FR-001

Plain Git behind the one interface (commons 0001-githost FR-001 to FR-003): any Git remote that is not GitHub or GitLab, read by running git. It answers the four common capabilities (the clone URL, credentials, the default branch and whether a commit's signature verifies) and returns unsupported for the rest: protected branches, issues and change requests are what a host adds, and plain Git has none.

A remote is asked with git ls-remote --symref, so its own credential helper authenticates and no terminal prompt is ever shown (GIT_TERMINAL_PROMPT=0); this adapter holds no credential and writes none. A signature is read from a clone that the caller names (localOf), by git log --format=%G?, with the user's own Git configuration (the key's allowedSignersFile for an SSH signature, the keyring for an OpenPGP one): the commit is verified where Git says G.

Source: commons/githost/src/git.ts

1 of 3 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

defaultBranchOffunctionno test imports it
function defaultBranchOf(lsRemote: string): string

The branch a git ls-remote --symref <url> HEAD says HEAD points to: empty where it says none (an empty repository).

plainGitClientfunction
function plainGitClient(options?: PlainGitOptions): GitHostClient

A plain Git client: the common four capabilities, and unsupported for protected branches, issues and change requests.

Imported by 8 tests of the run (8 passed, 0 failed): the library's results

PlainGitOptionstypeno test imports it
type PlainGitOptions = { /** The program (`git` on the path by default). */ readonly program?: string; /** The URL… (671 characters)
type PlainGitOptions = {
  /** The program (`git` on the path by default). */
  readonly program?: string;
  /** The URL or path a repository is asked from; its HTTPS clone URL by default. Never one with a credential in it. */
  readonly remoteOf?: (ref: RepoRef) => string;
  /** A clone of the repository on this computer, where the signature of a commit can be read; none by default (a signature is then `not-found`). */
  readonly localOf?: (ref: RepoRef) => string | undefined;
  /** Variables added to `git`'s environment (a test points `GIT_CONFIG_GLOBAL` at its own file; nothing here may be a credential). */
  readonly env?: Readonly<Record<string, string>>;
};

How a plain Git client is made.

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