Skip to content

fix(hooks): propagate custom hook failures#910

Open
Solaris-star wants to merge 1 commit into
charmbracelet:mainfrom
Solaris-star:fix/global-hook-exit-status
Open

fix(hooks): propagate custom hook failures#910
Solaris-star wants to merge 1 commit into
charmbracelet:mainfrom
Solaris-star:fix/global-hook-exit-status

Conversation

@Solaris-star

Copy link
Copy Markdown

Summary

A custom executable global hook's exit status was logged and then discarded by soft hook, causing Git to accept pushes even when a pre-receive hook rejected them.

This change returns the custom hook error from hooksRunE, so the generated Git hook dispatcher can propagate the failure to Git. It also extracts the executable-hook lookup into runCustomHook and adds focused tests covering failure propagation and ignored missing/non-executable hooks.

Fixes #909

Validation

  • go test ./cmd/soft/hook ./pkg/hooks
  • go vet ./cmd/soft/hook ./pkg/hooks
  • go test ./... (the package tests pass; the existing testscript suite requires Git LFS in the local environment and fails before exercising this change)

@Solaris-star

Copy link
Copy Markdown
Author

Verified against upstream main at 16c8e08. There are no competing open PRs for #909. Focused package tests and vet pass; full go test reaches the existing testscript suite but is blocked locally by missing Git LFS and unrelated baseline failures. The patch is intentionally limited to propagating the custom hook exit error plus focused regression coverage.

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.

Custom global pre-receive hook's exit code is discarded, so it can never reject a push

1 participant