Skip to content

fix(lefthook): check-affected pre-push job fails to parse on Windows and blocks every push #11356

Closed

Description

@kyle-sexton

Problem

On Windows (lefthook 2.2.2, Git for Windows sh.exe), the check-affected pre-push job in lefthook.yml exits 2 before running any check, which blocks the push:

merge-base: -c: line 2: unexpected EOF while looking for matching `)'
┃  check-affected ❯
exit status 2
error: failed to push some refs

lefthook run pre-push --job check-affected --verbose shows the cause. Lefthook wraps the multi-line run: body in double quotes without escaping the double quotes inside it:

[lefthook] run:  "C:\Program Files\Git\bin\sh.exe" -c "if ! mb="$(git merge-base HEAD refs/remotes/origin/main 2>/dev/null)"; then ...

Windows argv parsing ends the -c string at the first inner ", so sh gets a truncated script and $0 becomes merge-base.

Reproduce

On Windows, in any worktree of this repo, run lefthook run pre-push --job check-affected --verbose. It failed the same way twice on 2026-10-30, at commit 97e944b (lefthook.yml last changed in 67f790d).

Fix direction

Keep the run: body free of double quotes, or move it into a script that lefthook runs by path. Either way, keep the job's rule that check code is taken from the merge-base.

🤖 Generated with Claude Code

https://claude.ai/code/session_01UJUn7KoThXoYQoxfvdCVi7

Activity

  1. added
    needs-triage
    on Oct 30, 2026
  2. github-actions commented on Oct 30, 2026

    @github-actions
    Contributor

    Proposed work class: work-class: scoped
    Basis: automated intake triage; the lanes App applied this class.

    Size: Small
    Complexity: Medium
    Uncertainty: Known
    Flags: none
    Blocked by: none

    Understood: on Windows with lefthook 2.2.2 and Git for Windows sh.exe, the check-affected pre-push job in lefthook.yml fails to parse. Lefthook wraps the multi-line run: body in unescaped double quotes, so sh -c receives a truncated script and every push is blocked. The suggested fix is to keep the body free of double quotes, or move it into a script that lefthook runs by path, while still taking check code from the merge-base. The report has clear repro steps. I found no likely duplicates.

    Automated triage, applied by the lanes App.

  3. added and removed
    needs-triage
    on Oct 30, 2026
  4. added
    status: ready
    status: confirmed
    and removed
    status: ready
    on Oct 30, 2026
  5. melodic-automation-lanes commented on Oct 30, 2026

    @melodic-automation-lanes
    Contributor

    Not admitted to the issue lane: no trusted-human acceptance criteria: a listed human must put the confirmed - [ ] criteria in the body or post them as their own comment, or, on an issue a listed human filed, intake's newest refinement comment must hold them unedited. Admission takes the issue once each of those is met, when intake triages it again (.github/actions/resolve-config/admission-rules.json).

  6. melodic-automation-lanes commented on Oct 30, 2026

    @melodic-automation-lanes
    Contributor

    The latest triage verdict holds nothing: admission moved the issue to status: confirmed; its comment says why.

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

    status: confirmed

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions