Expand description
amont install — put the binary somewhere stable and wire up the shims.
This was a Makefile recipe. It moved here for one reason: the guard below decides whether a directory is safe to delete, it has been got wrong TWICE — both times overwriting tracked source files with machine-specific paths — and shell that runs on one platform cannot be tested on three.
Everything here is std. The commit path’s dependency posture
(scripts/check-no-deps.sh) is unchanged: this adds code, not crates.
§Why it is a subcommand and not a script
A .ps1 for Windows plus a Makefile for Unix would be two implementations of
that guard, in two languages, one of them untested — for a routine whose
failure mode is deleting your work. And make is not the Unix-only detail it
looks like: Git for Windows ships bash, sh and coreutils but NOT make,
so the dependency was the problem rather than the shell.
The shim text is embedded with include_str!, so an installed binary carries
its own shims and can install from any directory.
Re-exports§
pub use crate::hookfile::is_our_shim;pub use crate::hookfile::SHIM_MARKER;
Structs§
- Written
- One dispatcher that landed, and what stood at that path before it.
Enums§
- Shim
Write Error - Why a set of shims was not written.
- Template
Dir - What may be done with a candidate template directory.
Constants§
- DISPATCHERS
- The hook names git actually invokes, and so the only files we install.
- PLACEHOLDER
- The token every shim carries until it is baked.
- SHIM
- The one shim. All four git-invoked hooks are the same file — it passes its
own filename through — and
shims_on_disk_match_the_embedded_onekeeps the repository’stemplates/hooks/honest against this copy.
Functions§
- bake
- Write the absolute binary path into a shim.
- bin_dir
~/.local/bin, or$AMONT_BIN_DIR.- classify_
dir - Decide what may be done with
dir. Never mutates anything. - is_
bakeable - Whether the shim will accept
binas its baked path. - run
- Install: copy this binary somewhere stable, populate the template directory if that is safe, and bake the current repository’s hooks.
- template_
hooks_ dir $XDG_CONFIG_HOME/git/git-templates/templates/hooks.- uninstall
- Take the shims out of the repository we are standing in.