Skip to content

git-remote-entire: relay helper-status before send-pack exit check - #1364

Merged
pjbgf merged 2 commits into
mainfrom
helper-status
Jun 4, 2026
Merged

git-remote-entire: relay helper-status before send-pack exit check#1364
pjbgf merged 2 commits into
mainfrom
helper-status

Conversation

@pjbgf

@pjbgf pjbgf commented Jun 4, 2026

Copy link
Copy Markdown
Member

https://entire.io/gh/entireio/cli/trails/515

send-pack exits non-zero on per-ref rejections (D/F conflict, protected branch, server hook decline). The buffered error refs/X <reason> lines are what git's transport-helper.c reads to render the user-visible ! [remote rejected] output. Forwarding helper-status only on the happy path meant Wait/feed errors swallowed those lines, leaving users with only send-pack exited with error: exit status 1.

Relay helper-status before checking exit codes so the real reason reaches the user. Examples now surfaced:

Branch protection violation

! [remote rejected]     branch-test -> branch-test (upstream: push declined due to repository rule violations)
  error: failed to push some refs to 'X'

Invalid ref

! [remote rejected]     test-prefix -> test-prefix (ref name conflicts with an existing ref namespace)
  error: failed to push some refs to 'X'

Permissions:

! [remote rejected]   new-test/repo -> new-test/repo (pushing to GitHub: tracing transport: handshake: http transport: authorization failed: unexpected requesting "https://github.com/x/x/info/refs?service=git-receive-pack" status code: 403: Permission to x/x.git denied to <user>.)
  error: failed to push some refs to 'X'

Note

Low Risk
Small control-flow reorder in push handling; improves error output without changing auth or pack upload behavior.

Overview
Fixes push error reporting in the Entire git remote helper by writing send-pack helper-status to git before waiting on the feeder goroutine or send-pack exit code.

When the remote rejects refs (branch rules, bad ref names, auth failures), send-pack still emits error refs/... lines but exits non-zero. The old order returned on Wait/feedErr first, so those lines never reached git and users only saw a generic send-pack exited with error: exit status 1. Git can now show the usual ! [remote rejected] messages with the real reason.

Reviewed by Cursor Bugbot for commit ad52a59. Configure here.

send-pack exits non-zero on per-ref rejections (D/F conflict, protected
branch, server hook decline). The buffered `error refs/X <reason>` lines
are what git's transport-helper.c reads to render the user-visible
`! [remote rejected]` output. Forwarding helper-status only on the happy
path meant Wait/feed errors swallowed those lines, leaving users with
only `send-pack exited with error: exit status 1`.

Relay helper-status before checking exit codes so the real reason
reaches the user. Examples now surfaced:

  Branch protection violation
   ! [remote rejected]     branch-test -> branch-test (upstream: push declined due to repository rule violations)
  error: failed to push some refs to 'X'

  Invalid ref:
   ! [remote rejected]     test-prefix -> test-prefix (ref name conflicts with an existing ref namespace)
  error: failed to push some refs to 'X'

  Permissions:
   ! [remote rejected]   new-test/repo -> new-test/repo (pushing to GitHub: tracing transport: handshake: http transport: authorization failed: unexpected requesting "https://github.com/x/x/info/refs?service=git-receive-pack" status code: 403: Permission to x/x.git denied to <user>.)
  error: failed to push some refs to 'X'

Assisted-by: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: Paulo Gomes <paulo@entire.io>
Entire-Checkpoint: 25d3ab26f571
@pjbgf
pjbgf requested a review from a team as a code owner June 4, 2026 13:11
Copilot AI review requested due to automatic review settings June 4, 2026 13:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves git-remote-entire push error reporting by ensuring send-pack --helper-status output is relayed to Git before returning on send-pack/feeder errors, so Git can render per-ref rejection reasons (e.g., branch protection, invalid ref, permission failures) instead of only a generic exit-status error.

Changes:

  • Reorders handlePush to write the buffered helper-status lines to stdout prior to checking feeder errors and send-pack exit status.
  • Keeps the push status batch terminator (blank line) immediately after relaying helper-status so Git can finish parsing the status section even on failure.

Comment thread internal/remotehelper/githelper/push.go
nodo
nodo previously approved these changes Jun 4, 2026
handlePush relays send-pack's helper-status lines to stdout before
checking the subprocess exit code, so per-ref rejections (branch
protection, D/F conflict, server hook decline) reach git's
transport-helper.c and render as `! [remote rejected] <ref> (<reason>)`.
Pin that ordering: a PATH-injected shell stub plays the role of
`git send-pack`, emits an empty wrapped request followed by a trailing
flush + `error <ref> ...` helper-status line, and exits 1. The test
asserts that handlePush both returns the exit error AND has already
written the helper-status to stdout. Verified failing against the
pre-fix push.go (helperStatus empty in stdout).

Assisted-by: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: Paulo Gomes <paulo@entire.io>
Entire-Checkpoint: d814978a0c6c
@pjbgf
pjbgf merged commit d239d10 into main Jun 4, 2026
9 checks passed
@pjbgf
pjbgf deleted the helper-status branch June 4, 2026 13:58
@cursor cursor Bot mentioned this pull request Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants