Expand description
MG.1: magit-global universal minor mode — entry-point chords.
Activates on every buffer (Universal policy) so C-x g,
C-c g, and C-c f work from any buffer kind — document,
help, file tree, oil, terminal, etc.
Fold audit fix (MG.8): also contributes the action:magit-global-*
handlers the root dispatch transient’s items fire. These exist
precisely because TransientItemKind::Action dispatch resolves
through ActionHandlerRegistry::lookup only — never through the
ex-command path — so an item that should “open the log buffer
from wherever the user happens to be” can’t just target the
magit-log ex-command’s CommandId; nothing in
ActionHandlerRegistry answers for it. Every OTHER
action:magit-* handler in this crate is registered per-buffer
from on_activate (only live while its owning magit buffer is
the one that activated it) — these are global instead, via
[Mode::action_handlers], because this mode’s
ActivationPolicy::Universal means they’re needed everywhen,
matching what a global dispatch menu needs.
Bug fix history: an earlier version registered these from
on_activate itself, gated by a OnceLock so the
process-lifetime handlers were only installed once despite
Universal re-running on_activate on every buffer. That was
fundamentally racy: Mode::on_activate’s returned future runs
through a “try-sync-then-spawn” cascade
(lattice_mode::registry::ModeRegistry::spawn_cascade) shared
with every OTHER mode admitted by the same activation batch — if
any mode ordered earlier in that batch has real async work, the
WHOLE batch (including this mode’s own, otherwise-synchronous,
step) defers to a background task with no guarantee it completes
before the user’s next keystroke. Symptom: C-c g/C-c f opened
the transient fine (its CommandIds resolve independently, from
CommandRegistry at install() time), but every item’s key just
dismissed the menu and did nothing — ActionHandlerRegistry::lookup
returned None because the handler registration hadn’t run yet,
or (with a separate now-fixed bug where the guard latched on the
FIRST ATTEMPT regardless of success) had permanently failed to
run at all. [Mode::action_handlers] sidesteps the whole hazard:
the host’s register_mode_action_handlers walks every mode’s
contributed list in a plain synchronous for loop at boot,
strictly after the command registry is frozen — no cascade, no
Universal-activation timing dependency, no per-buffer state
needed (these handlers close over nothing but read ActionContext
at call time), so no on-activate registration is needed at all.
Structs§
- Commit
Op - MG.20: an operation that acts on ONE commit.
- GitStep
- MG.42-E2: one step of a composite operation.
- Magit
Global Mode - Remote
Flag - MG.17a: one argument on a
RemoteOp. - Remote
Op - Subtree
Op - One
git subtreeoperation.
Enums§
- Remote
ArgKind - MG.17b: what an argument contributes to the command line.
- Remote
Target - MG.16: one detached git operation, named once.
Functions§
- resolve_
upstream - MG.41c: resolve
@{upstream}into theremote branchpair a push destination needs. - spawn_
clone - Clone
urlintodest, off the actor thread. - spawn_
commit_ op - Run a
CommitOpagainstcommit, off the actor thread. - spawn_
computed - MG.43d: run a multi-step operation whose LATER steps depend on state only discoverable part-way through.
- spawn_
git - spawn_
git_ sequence - MG.42-E2: run several git invocations in order as ONE operation.
- spawn_
gitignore - MG.23c1: append
patternto the repository’s.gitignore. - spawn_
rebase_ verb - MG.43c: run a one-commit interactive rebase off the actor thread.
- spawn_
rebase_ verb_ with - spawn_
remote_ op - spawn_
remote_ op_ to - Run
opoff the actor thread and return the optimistic echo. - spawn_
subtree_ op - Run a subtree operation off the actor thread, reporting completion.