Skip to main content

Module repo_scope

Module repo_scope 

Source
Expand description

MR.2: which repository each magit buffer is acting on.

A magit buffer’s name carries the repository’s basename because that is what a user recognises in :ls. A basename cannot round-trip to a path and two checkouts can share one, so the name is not the source of truth — this is (design §3.1). The trigger resolves the repository and records it here; the view reads it back when it activates, and (MR.4) every action body in that buffer reads it instead of re-resolving.

Keyed by buffer name, not id. The trigger runs before the buffer exists — that is the whole reason a side channel is needed at all (on_activate cannot see what the trigger saw) — so there is no id to key on yet. BufferStore::name_for then makes id → name → workdir a lookup rather than a second map to keep in sync.

Not one-shot. ViewArgsRequests and BlameRequests, the two side channels this shape comes from, are taken on activation because a request is for one activation. This one is read for the buffer’s whole life: s in a status buffer stages into the repo the buffer is showing, every time it is pressed, or the buffer is worse than it was before MR.2 (design §4).

Structs§

RepoScopes
Buffer name → the repository that buffer acts on.

Functions§

action_workdir
active_workdir for an action handler, which carries the services rather than the handles.
active_workdir
MR.4: the repository an action acts on — the one question every magit action body asks, answered in one place.
label_of_buffer
MR.3b: the repository label a magit buffer’s own name carries, for a producer that has the buffer store but no services.
open_repo_view
MR.2: the single path from “a magit trigger fired” to “the buffer it opens” — resolve the repository, name the buffer for it, record which repository that buffer acts on.
open_repo_view_at
PC.3: open_repo_view for a repository named EXPLICITLY.
open_repo_view_with
MR.3: open_repo_view for a view that encodes parameters of its own — the commit family’s target (*magit:augment:<repo>:<sha>*) and, from MR.3b, the path- and revision-scoped views.
repo_view_name
The naming half of open_repo_view, split out so a test can assert which buffer a trigger lands on without an Effect in the way.
repo_view_name_at
PC.3: repo_view_name for an explicitly-named repository.
repo_view_name_with
Resolve the repository, compose the name, record what the buffer acts on. The single body under every magit trigger.
view_workdir
MR.3: the repository a magit view acts on, read at activation — the other end of what open_repo_view wrote.
workdir_or_cwd
active_workdir with the working directory as the fall-back — the form the operation helpers want, since they need a directory to run git in and “not in a repository” is git’s error to report, not ours.

Type Aliases§

RepoScopesHandle
Typed handle for ServiceRegistry lookup — register and look up under THIS alias (feedback_servicesregistry_arc_typeid).