Skip to content

fix: honor updateRef when creating signed commits - #225

Merged
marshallku merged 2 commits into
toss:mainfrom
xxxxxxjun:fix/signed-commit-update-ref
Sep 8, 2026
Merged

fix: honor updateRef when creating signed commits#225
marshallku merged 2 commits into
toss:mainfrom
xxxxxxjun:fix/signed-commit-update-ref

Conversation

@xxxxxxjun

Copy link
Copy Markdown
Contributor

Summary

commit() ignored updateRef when a signature was given, leaving the signed
commit unreachable. The signed path now does what libgit2 already does for
unsigned commits.

Changes

  • Resolve updateRef before writing the object, then point it at the new commit.
    Covers symbolic refs, unborn HEAD, and refs that don't exist yet.
  • Reject a commit whose first parent isn't the current tip of updateRef. The
    check runs before commit_signed(), so a rejected commit leaves nothing in the odb.
  • Record the same reflog entry as the unsigned path.

Notes

The first-parent check goes beyond the reported bug and turns a silent success
into an error. Without it, moving the ref on a mismatched first parent would let
a branch jump across history. Everything that pairs signature with updateRef
today (the existing test and the two usage/commit.md examples) already passes
the current tip.

Closes #218

@xxxxxxjun
xxxxxxjun requested a review from seokju-na as a code owner August 30, 2026 04:56
@vercel

vercel Bot commented Aug 30, 2026

Copy link
Copy Markdown

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

A member of the Team first needs to authorize it.

@marshallku
marshallku self-requested a review as a code owner September 1, 2026 02:58

@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!

@marshallku
marshallku merged commit db852dc into toss:main Sep 8, 2026
37 of 38 checks passed
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