DialectoInContext.GitContext (dialecto_in_context v0.1.0)

Copy Markdown View Source

The site's context for the sidebar (spec-0016 §4, served at /__dialecto/context): {repo, project, branch, sha, dirty, addon}, read from git on demand so switching branches needs no restart. A git failure only leaves its field empty.

Summary

Functions

owner/name from a GitHub remote URL in any of its common spellings, else nil.

Repo-root-relative paths (sorted, unique, capped) from git status --porcelain=v1 -z.

The context for settings (see DialectoInContext.Config), run in root.

Functions

parse_github_remote(remote)

@spec parse_github_remote(String.t() | nil) :: String.t() | nil

owner/name from a GitHub remote URL in any of its common spellings, else nil.

parse_porcelain_z(output)

@spec parse_porcelain_z(String.t() | nil) :: [String.t()]

Repo-root-relative paths (sorted, unique, capped) from git status --porcelain=v1 -z.

read(settings, root \\ File.cwd!())

@spec read(map(), String.t()) :: map()

The context for settings (see DialectoInContext.Config), run in root.