l0.DependencyControl.GitRepository¶
GitRepository ¶
Interface to a local git repository for running git commands.
Constructor ¶
Creates an interface to the git repository rooted at dir.
| param | type | description |
|---|---|---|
| dir | string |
Absolute path to the repository root. |
Instance methods¶
run ¶
Runs a git command and returns trimmed stdout+stderr, or nil on failure or empty output.
| param | type | description |
|---|---|---|
| args | string |
Command and flags passed verbatim after git -C <dir>. |
Returns:
outputstring?
getBranch ¶
Returns the branch name the given ref resolves to.
| param | type | description |
|---|---|---|
| ref? | string |
Git ref to resolve (defaults to HEAD). |
Returns:
branchstring? — Short branch name, or nil when the command fails.
getCommitHash ¶
Returns the abbreviated commit hash of the given ref.
| param | type | description |
|---|---|---|
| ref? | string |
Git ref to resolve (defaults to HEAD). |
Returns:
hashstring? — Seven-character commit hash, or nil when the command fails.
isAtTag ¶
Reports whether the given ref sits exactly on a tag.
| param | type | description |
|---|---|---|
| ref? | string |
Git ref to test (defaults to HEAD). |
Returns:
atTagboolean— True when the ref points exactly at a tag.
getVersionSuffix ¶
Returns a git describe-style version suffix for the given ref.
Returns "" when the ref is exactly on a tag, "-
| param | type | description |
|---|---|---|
| ref? | string |
Git ref to describe (defaults to HEAD). |
Returns:
suffixstring