Skip to content

build: resolve electron_version from git when building in a worktree#51166

Merged
ckerr merged 1 commit into42-x-yfrom
trop/42-x-y-bp-build-resolve-electron_version-from-git-when-building-in-a-worktree-1776671669183
Apr 20, 2026
Merged

build: resolve electron_version from git when building in a worktree#51166
ckerr merged 1 commit into42-x-yfrom
trop/42-x-y-bp-build-resolve-electron_version-from-git-when-building-in-a-worktree-1776671669183

Conversation

@trop
Copy link
Copy Markdown
Contributor

@trop trop bot commented Apr 20, 2026

Backport of #51146

See that PR for details.

Notes: Fixed gn gen failing to resolve electron_version when building from a git worktree checkout.

BUILD.gn previously hard-coded read_file(".git/packed-refs", ...) and
".git/HEAD" to derive electron_version. In a `git worktree` checkout
.git is a file containing a gitdir: pointer, not a directory, so GN's
read_file() fails and gn gen aborts unless override_electron_version is
set manually.

Ask git itself for the real locations via `git rev-parse --git-dir` /
`--git-common-dir` in a small helper script, and feed those resolved
paths to read_file() and the exec_script dependency list. Behaviour in
a plain clone is unchanged (both resolve to electron/.git/...), and the
tarball case still fails loudly with a pointer to
override_electron_version.

Co-authored-by: Sam Attard <sattard@anthropic.com>
@ckerr ckerr merged commit 7790ade into 42-x-y Apr 20, 2026
77 checks passed
@ckerr ckerr deleted the trop/42-x-y-bp-build-resolve-electron_version-from-git-when-building-in-a-worktree-1776671669183 branch April 20, 2026 13:24
@release-clerk
Copy link
Copy Markdown

release-clerk bot commented Apr 20, 2026

Release Notes Persisted

Fixed gn gen failing to resolve electron_version when building from a git worktree checkout.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants