Logo Partas.TypeProvider

Runtime Module

Functions invoked from erased quotations - these run in the *consuming* program, not in the compiler, and must never throw.

Types

Type Description

RevisionDetails

Functions and values

Function or value Description

commitsAhead workTree baseRef headRef

Full Usage: commitsAhead workTree baseRef headRef

Parameters:
    workTree : string
    baseRef : string
    headRef : string

Returns: int

Commits reachable from `headRef` but not from `baseRef`. Returns 0 when git is unavailable, either ref is missing, or the call times out.

workTree : string
baseRef : string
headRef : string
Returns: int

commitsAheadOfUpstream workTree gitDir commonDir

Full Usage: commitsAheadOfUpstream workTree gitDir commonDir

Parameters:
    workTree : string
    gitDir : string
    commonDir : string

Returns: int

Commits in HEAD not yet pushed to the configured upstream branch. Returns 0 when HEAD is detached, no upstream is configured, or git is unavailable.

workTree : string
gitDir : string
commonDir : string
Returns: int

commitsBehind workTree baseRef headRef

Full Usage: commitsBehind workTree baseRef headRef

Parameters:
    workTree : string
    baseRef : string
    headRef : string

Returns: int

Commits reachable from `baseRef` but not from `headRef`. Inverse of `commitsAhead`.

workTree : string
baseRef : string
headRef : string
Returns: int

commitsBehindUpstream workTree gitDir commonDir

Full Usage: commitsBehindUpstream workTree gitDir commonDir

Parameters:
    workTree : string
    gitDir : string
    commonDir : string

Returns: int

Commits in the configured upstream branch not yet merged into HEAD. Returns 0 when HEAD is detached, no upstream is configured, or git is unavailable.

workTree : string
gitDir : string
commonDir : string
Returns: int

exec workTree args

Full Usage: exec workTree args

Parameters:
    workTree : string
    args : string

Returns: string

Escape hatch for arbitrary read-only git commands. Returns "" on failure.

workTree : string
args : string
Returns: string

headBranch gitDir

Full Usage: headBranch gitDir

Parameters:
    gitDir : string

Returns: string

The checked-out branch name, or "" when HEAD is detached.

gitDir : string
Returns: string

headBranchIsAvailable gitDir commonDir

Full Usage: headBranchIsAvailable gitDir commonDir

Parameters:
    gitDir : string
    commonDir : string

Returns: bool

Whether HEAD identifies a branch with a commit available to inspect.

gitDir : string
commonDir : string
Returns: bool

headIsAvailable gitDir commonDir

Full Usage: headIsAvailable gitDir commonDir

Parameters:
    gitDir : string
    commonDir : string

Returns: bool

Whether HEAD currently resolves to a commit.

gitDir : string
commonDir : string
Returns: bool

headSha gitDir commonDir

Full Usage: headSha gitDir commonDir

Parameters:
    gitDir : string
    commonDir : string

Returns: string

The sha HEAD resolves to. "" in a repository with no commits yet.

gitDir : string
commonDir : string
Returns: string

isAvailable ()

Full Usage: isAvailable ()

Parameters:
    () : unit

Returns: bool

Whether a usable `git` is on PATH in the consuming environment.

() : unit
Returns: bool

isDetached gitDir

Full Usage: isDetached gitDir

Parameters:
    gitDir : string

Returns: bool
gitDir : string
Returns: bool

isDirty workTree

Full Usage: isDirty workTree

Parameters:
    workTree : string

Returns: bool

True when the working tree or index has changes.

workTree : string
Returns: bool

latestTag workTree

Full Usage: latestTag workTree

Parameters:
    workTree : string

Returns: string

The nearest ancestor tag reachable from HEAD, via `git describe --tags --abbrev=0`. Returns "" when no tags are reachable or git is unavailable.

workTree : string
Returns: string

latestTagDetails workTree

Full Usage: latestTagDetails workTree

Parameters:
    workTree : string

Returns: RevisionDetails

Revision details for the nearest ancestor tag. Returns the empty record when no tag is reachable.

workTree : string
Returns: RevisionDetails

latestTagRevisionDetails workTree expression

Full Usage: latestTagRevisionDetails workTree expression

Parameters:
    workTree : string
    expression : string

Returns: RevisionDetails

Revision details for the given expression relative to the nearest ancestor tag. Returns the empty record when no tag is reachable.

workTree : string
expression : string
Returns: RevisionDetails

resolveRef commonDir refName

Full Usage: resolveRef commonDir refName

Parameters:
    commonDir : string
    refName : string

Returns: string

Resolves a ref name such as `refs/heads/main` to a sha, following symbolic refs. Returns "" when the ref no longer exists.

commonDir : string
refName : string
Returns: string

resolveRevision workTree baseRef expression

Full Usage: resolveRevision workTree baseRef expression

Parameters:
    workTree : string
    baseRef : string
    expression : string

Returns: string

Resolves a git revision expression to a commit SHA. Returns an empty string when the expression is unavailable or does not name a commit.

workTree : string
baseRef : string
expression : string
Returns: string

revisionDetails workTree baseRef expression

Full Usage: revisionDetails workTree baseRef expression

Parameters:
    workTree : string
    baseRef : string
    expression : string

Returns: RevisionDetails

Reads the commit identity and display metadata in one git invocation. The result is cached because each generated property may be accessed independently by a consuming build script.

workTree : string
baseRef : string
expression : string
Returns: RevisionDetails

revisionExpression baseRef expression

Full Usage: revisionExpression baseRef expression

Parameters:
    baseRef : string
    expression : string

Returns: string

Applies a revision suffix to a ref. A leading `~` or `^` is interpreted relative to the generated branch, while all other expressions are passed to git as written.

baseRef : string
expression : string
Returns: string

shortRevision workTree baseRef expression

Full Usage: shortRevision workTree baseRef expression

Parameters:
    workTree : string
    baseRef : string
    expression : string

Returns: string

Resolves a git revision expression to a seven-character display SHA.

workTree : string
baseRef : string
expression : string
Returns: string

tryExec workTree args

Full Usage: tryExec workTree args

Parameters:
    workTree : string
    args : string

Returns: string option
workTree : string
args : string
Returns: string option

tryExecTimeout timeoutMs workTree args

Full Usage: tryExecTimeout timeoutMs workTree args

Parameters:
    timeoutMs : int
    workTree : string
    args : string

Returns: string option

Runs `git` in `workTree`, returning trimmed stdout on success and `None` on failure, non-zero exit, timeout, or a missing `git`.

timeoutMs : int
workTree : string
args : string
Returns: string option

Type something to start searching.