Skip to content

Fix signed first commits on unborn branches - #3059

Open
hrouault wants to merge 1 commit into
gitui-org:masterfrom
hrouault:fix/signed-first-commit
Open

hrouault wants to merge 1 commit into
gitui-org:masterfrom
hrouault:fix/signed-first-commit

Conversation

@hrouault

@hrouault hrouault commented Nov 26, 2026 •

Copy link
Copy Markdown

A signed first commit could create a branch named master while leaving
the selected branch empty. GitUI tried to resolve HEAD before its target
existed, then chose a branch using the initialization default.

When libgit2 reports an unborn branch, read the symbolic target of HEAD
and create that reference at the signed commit. Propagate other errors.

The regression test signs a first commit on experiment with a disposable
SSH key and init.defaultBranch=main. It checks that the selected branch
points to the signed commit and is the only local branch. The test failed
before the fix and passes afterward.

Verified on macOS with cargo fmt --all -- --check,
cargo check --locked --workspace, and cargo test --locked --workspace.

Fixes #2689.

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.

First commit weirdness

1 participant