Skip to content

Skip lefthook reinstall in .envrc when already installed - #104

Merged
igorhrcek merged 1 commit into
mainfrom
feature/sre-35554-distribute-an-improved-envrc-to-all-repositories-using
Sep 24, 2026
Merged

igorhrcek merged 1 commit into
mainfrom
feature/sre-35554-distribute-an-improved-envrc-to-all-repositories-using

Conversation

@igorhrcek

Copy link
Copy Markdown
Contributor

What

.envrc ran lefthook install on every direnv load, reinstalling hooks even when they were already in place and slowing down cd into the repo. This PR changes it to:

watch_file <lefthook config>
lefthook check-install >/dev/null 2>&1 || lefthook install >/dev/null
  • lefthook check-install exits 0 when hooks are installed and up to date, so the reinstall only happens when needed.
  • watch_file makes direnv reload when the lefthook config changes, so edited hooks still get reinstalled.

After merging

git pull
direnv allow

Why

SRE-35554. Generated by rollout/ensure-envrc.sh in mailerlite/git-hooks. Questions → @igorhrcek.

Runs `lefthook install` only when `lefthook check-install` reports missing
or stale hooks, and watches the repo's lefthook config so direnv reloads
when it changes.
@igorhrcek igorhrcek self-assigned this Sep 24, 2026
@igorhrcek
igorhrcek merged commit ba3258b into main Sep 24, 2026
4 checks passed
@igorhrcek
igorhrcek deleted the feature/sre-35554-distribute-an-improved-envrc-to-all-repositories-using branch September 24, 2026 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant