Skip to content

fix: Honor updateRef when creating signed commits - #224

Closed
VedantMadane wants to merge 1 commit into
toss:mainfrom
VedantMadane:fix/issue-218
Closed

fix: Honor updateRef when creating signed commits#224
VedantMadane wants to merge 1 commit into
toss:mainfrom
VedantMadane:fix/issue-218

Conversation

@VedantMadane

Copy link
Copy Markdown

Summary

Honor updateRef when creating signed commits

Changes

  • After commit_signed, update the named ref (create or set_target)
  • Matches unsigned commit() behavior so signed commits are not unreachable

Fixes #218

@vercel

vercel Bot commented Aug 25, 2026

Copy link
Copy Markdown

@VedantMadane is attempting to deploy a commit to the Toss Team on Vercel.

A member of the Team first needs to authorize it.

- After commit_signed, update the named ref (create or set_target)
- Matches unsigned commit() behavior so signed commits are not unreachable

Fixes toss#218

Signed-off-by: Vedant Madane <6527493+VedantMadane@users.noreply.github.com>

@marshallku marshallku left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for taking this on, and sorry for the slow response.

Unfortunately this doesn;t fix #218 as written. Repository::find_reference is git_reference_lookup, which does not resolve symbolic references. HEAD is symbolic in a normal repository, so set_targe hits libgit2's ensure_is_an_updatable_direct_reference() and fails with cannot set OID on symbolic reference. I reproduced it against the pinned git2 =0.20.4:

So updateRef: 'HEAD' — the exact case in #218 — goes from a silent no-op to a thrown error, and the existing create signed commit test (tests/commit.spec.ts:67) plus the documented example in docs/usage/commit.md:54 would both break. CI hasn't run on this branch yet, so it hasn't surfaced.

The primitive libgit2 uses here is git_reference_lookup_resolved (git2: find_reference(name)?.resolve()), and its unsigned path also validates the first parent against the current tip before writing the object. #225 implements that with tests, so I'm closing this in favour of it.

Thank you for the effort regardless — please do keep an eye on the issue list.

@marshallku marshallku closed this Sep 9, 2026
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.

Repository#commit() ignores updateRef when signature is provided

2 participants