Skip to content

Name Who Enables the Hook in the Pre-Commit Rollout's Per-Repo Conversion #4327

Open

Description

@ptr727

Problem

docs/pre-commit-hooks-rollout.md "Per-Repo Conversion" tells the converting agent to enable the hook, through core.hooksPath or pre-commit install. Both write repository-wide git configuration that every worktree shares. Run from a linked worktree, which is where a task works per repo-worktree, that step conflicts with the existing rule against changing shared hooks from a linked worktree. Since #4323, a missing or wrong shared hook is also the maintainer's to repair, not an agent's.

This is first-time adoption rather than a repair, so #4323's rule does not decide it. The doc still names no one to run the step and no checkout to run it from.

Done looks like

  • The conversion's enable step names who enables the hook and from which checkout, so it agrees with the linked-worktree rule and with repo-worktree "Preparing Git Hooks".
  • Where the step is the maintainer's, the doc gives him the exact command.

Found by #4323's review and listed there as pre-existing.

🤖 Generated with Claude Code

Activity

  1. added
    documentation
    on Nov 20, 2026
  2. ptr727 commented on Nov 24, 2026

    @ptr727
    OwnerAuthor

    Question for the maintainer (backlog-burndown planner, away mode, 2026-11-24). This issue turns on an outcome the committed rules do not settle, so the away run labels it decision and holds it.

    Question: who enables a repository's pre-commit hook the first time, during the "Per-Repo Conversion" in docs/pre-commit-hooks-rollout.md, and from which checkout?

    repo-worktree "Preparing Git Hooks" says no agent changes a shared hook or its setting from a linked worktree, and that a missing or wrong shared hook is the maintainer's to repair by hand. It speaks of repair, so it does not plainly cover first-time adoption, which is the case this doc describes.

    Options, recommended first:

    1. The maintainer enables it, by hand, from his own checkout (recommended). The conversion's enable step names him and gives the exact command for each framework (git config core.hooksPath .husky, or pre-commit install). The converting agent lists the step in its report as needing the maintainer, and CI stays the gate until he runs it. This treats a never-enabled hook as a missing one, which keeps one rule for every shared-hook write.
    2. The converting agent enables it, but only from a standalone clone, whose config and hooks are its own, and the maintainer enables it in his own checkouts. This automates the agent's tree and still leaves the shared setting to him.
    3. The converting agent enables it from the primary checkout as part of the conversion. This is the most automatic, and it is the shared-setting write the linked-worktree rule exists to prevent, so it would need that rule to name an exception.

    Effect on work in flight: none. No branch touches docs/pre-commit-hooks-rollout.md today.

  3. added
    decision
    on Nov 24, 2026
  4. ptr727 commented on Nov 25, 2026

    @ptr727
    OwnerAuthor

    Answered by the maintainer (decision triage, 2026-11-25): a hub-hosted Python script enables the hook, once per clone.

    Enabling a hook is per clone. core.hooksPath, or the hook pre-commit install writes, lives in the clone's own .git/, which its worktrees share. Nothing committed and no GitHub setting can turn it on. So the step can't live in repo-config/configure.sh, which writes GitHub-side settings, is Bash only, and needs admin.

    The step is a new hub-hosted Python script, reached through hub_fetch_run.py like the other hub tooling:

    • It detects the repo's framework (.husky/, .pre-commit-config.yaml, or Husky.Net with its dotnet tool restore and dotnet husky install) and enables it idempotently.
    • It reports what it found and what it changed, and an unchanged run writes nothing.
    • It has tests, and one script covers Linux, macOS and Windows, so no .sh/.ps1 pair is needed.
    • It runs wherever a clone is made: the maintainer's own checkouts, an agent's standalone clone, and repo-worktree's base clone. It never runs from a linked worktree, which keeps the repo-worktree "Preparing Git Hooks" rule intact.

    docs/pre-commit-hooks-rollout.md "Per-Repo Conversion" names the script in place of the raw commands. The issue stays open as work.

  5. removed
    decision
    on Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions