Liking cljdoc? Tell your friends :D

com.blockether.vis.internal.workspace.git

Shared workspace inspection, backed by the native git binary.

UI surfaces and extensions depend on this namespace instead of embedding their own git calls. It reports small, renderable facts about the current repository (branch, dirty buckets, ahead/behind, porcelain entries) by shelling out to git status --porcelain=v2 and git rev-parse, parsed into stable Clojure maps. No JGit — the only git implementation is the one already on the user's PATH, so behaviour matches their shell exactly.

Workspace lifecycle mutations stay in com.blockether.vis.internal.workspace.core.

Shared workspace inspection, backed by the native `git` binary.

UI surfaces and extensions depend on this namespace instead of embedding
their own git calls. It reports small, renderable facts about the current
repository (branch, dirty buckets, ahead/behind, porcelain entries) by
shelling out to `git status --porcelain=v2` and `git rev-parse`, parsed
into stable Clojure maps. No JGit — the only git implementation is the one
already on the user's PATH, so behaviour matches their shell exactly.

Workspace lifecycle mutations stay in
`com.blockether.vis.internal.workspace.core`.
raw docstring

commit!clj

(commit! dir args opts)

Run a literal git ... commit ... invocation through the fail-closed :git/commit around-hook boundary.

The Git adapter, not an extension, owns syntax and exactness: it resolves the effective work-tree after global options, rejects commit forms that construct a tree from anything other than the staged index, computes T0, rechecks T0 after authorization, runs Git, and asserts the resulting HEAD tree.

Run a literal `git ... commit ...` invocation through the fail-closed
`:git/commit` around-hook boundary.

The Git adapter, not an extension, owns syntax and exactness: it resolves the
effective work-tree after global options, rejects commit forms that construct
a tree from anything other than the staged index, computes T0, rechecks T0
after authorization, runs Git, and asserts the resulting HEAD tree.
sourceraw docstring

cwd-fileclj

(cwd-file)

Canonical current working directory as a File. Indirected for tests.

Canonical current working directory as a File. Indirected for tests.
sourceraw docstring

in-repository?clj

(in-repository? start)

True when start is inside a git repository.

True when `start` is inside a git repository.
sourceraw docstring

porcelain-tokensclj

(porcelain-tokens dir {:keys [ignored? untracked-all?]})

Structured status of the repo containing dir, or nil when dir is outside a repo / git is unavailable. Options: :ignored? adds ! entries, :untracked-all? recurses untracked dirs into individual files.

Returns {:branch <str> :head <sha|nil> :detached? bool :upstream? bool :ahead <int> :behind <int> :entries [{:x :y :type :path :dir?}]}.

Structured status of the repo containing `dir`, or nil when `dir` is outside
a repo / git is unavailable. Options: `:ignored?` adds `!` entries,
`:untracked-all?` recurses untracked dirs into individual files.

Returns {:branch <str> :head <sha|nil> :detached? bool :upstream? bool
         :ahead <int> :behind <int> :entries [{:x :y :type :path :dir?}]}.
sourceraw docstring

repo-work-treeclj

(repo-work-tree start)

Canonical work-tree directory (top level) of the repository containing start, or nil when start is outside any git repo. Without a .git entry above start, the answer is nil without a git run. A found work tree is reused while the nearest .git entry stays the same.

Canonical work-tree directory (top level) of the repository containing
`start`, or nil when `start` is outside any git repo. Without a `.git` entry
above `start`, the answer is nil without a git run. A found work tree is
reused while the nearest `.git` entry stays the same.
sourceraw docstring

run-gitclj

(run-git dir args)
(run-git dir args {:keys [timeout-secs]})

Run git <args> in dir (a File). args is a seq of stringable tokens. Returns {:exit <int|nil> :out <stdout> :err <stderr> :duration-ms <long>}; :exit is nil when the process could not be spawned, timed out, or the calling thread was interrupted. Never throws — repo-less and git-less environments degrade to {:exit nil …}. The 3-arity opts map takes :timeout-secs (default 10).

The child is ALWAYS reaped. A cancelled turn re-arms the thread's interrupt flag, so .waitFor throws INSTANTLY on this and every following call: an abandoned git status would keep running, holding .git/index.lock, while the caller spawns the next one.

Run `git <args>` in `dir` (a File). `args` is a seq of stringable tokens.
Returns `{:exit <int|nil> :out <stdout> :err <stderr> :duration-ms <long>}`;
`:exit` is nil when the process could not be spawned, timed out, or the
calling thread was interrupted. Never throws — repo-less and git-less
environments degrade to `{:exit nil …}`.
The 3-arity opts map takes `:timeout-secs` (default 10).

The child is ALWAYS reaped. A cancelled turn re-arms the thread's interrupt
flag, so `.waitFor` throws INSTANTLY on this and every following call: an
abandoned `git status` would keep running, holding `.git/index.lock`, while
the caller spawns the next one.
sourceraw docstring

status-countsclj

(status-counts porcelain)

Detailed, environment-facing counters from a parsed porcelain map (as returned by the private status reader). Mirrors the historical JGit shape.

Detailed, environment-facing counters from a parsed porcelain map (as
returned by the private status reader). Mirrors the historical JGit shape.
sourceraw docstring

vcs-kindclj

(vcs-kind root)

The :vcs/kind for a workspace root: :git when the root sits inside a git repository, else :none. Single source of truth so the model-facing CTX, the env, and channels all agree — staying inside the ctx-spec set #{:git :hg :jj :fossil :none}. NOTE: :rift (the CoW-clone sandbox mechanism) is NOT a VCS and must never appear here; sandbox-ness lives on :workspace/sandbox?.

The `:vcs/kind` for a workspace `root`: `:git` when the root sits inside a
git repository, else `:none`. Single source of truth so the model-facing
CTX, the env, and channels all agree — staying inside the ctx-spec set
#{:git :hg :jj :fossil :none}. NOTE: `:rift` (the CoW-clone sandbox
mechanism) is NOT a VCS and must never appear here; sandbox-ness lives on
`:workspace/sandbox?`.
sourceraw docstring

working-tree-statusclj

(working-tree-status)
(working-tree-status start)

Return git facts for start (default cwd).

Outside git, returns {:workspace? false} so callers can explicitly render the absence of a workspace. Inside git, returns:

{:workspace? true :repo <repo-name> :branch <branch-name> :modified 2 :created 1 :deleted 0 :upstream? true :ahead 4 :behind 0}

Return git facts for `start` (default cwd).

Outside git, returns `{:workspace? false}` so callers can explicitly render
the absence of a workspace. Inside git, returns:

  {:workspace? true
   :repo <repo-name>
   :branch <branch-name>
   :modified 2 :created 1 :deleted 0
   :upstream? true :ahead 4 :behind 0}
sourceraw docstring

workspace-statusclj

(workspace-status root)

Working-tree status of the repository at root, as a gateway session fact. Each canonical root keeps its value, so tab switches, turn ends and footer syncs do not wait for git. The first call for a root runs git on this thread, so a real root never gives nil. After default-cache-ms, a call returns the kept value at once and refreshes it on a future. Never throws: nil for a nil or blank root, or after a logged failure.

Working-tree status of the repository at `root`, as a gateway session fact.
Each canonical root keeps its value, so tab switches, turn ends and footer syncs do
not wait for git. The first call for a root runs git on this thread, so a real root
never gives nil. After `default-cache-ms`, a call returns the kept value at once and
refreshes it on a future. Never throws: nil for a nil or blank `root`, or after a
logged failure.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close