fix(git): interpret bare HEAD through the shared resolver and stop overwriting .Upstream with the remote list - #7803
Closed
e-kulikov wants to merge 2 commits into
Closed
Conversation
4 tasks
📦 Release binary size reportCompares this PR's release-equivalent build against the latest published release, per OS (amd64).
🎉 Binary size shrank on at least one platform. |
Keep mainSCMDir checkout-specific and scmDir repository-wide across worktrees, submodules, bare repositories, and separate git directories. Read config, remotes, worktree counts, repository names, and native status from the correct directory, with regression coverage for the supported layouts. Fixes JanDeDobbeleer#7798
e-kulikov
force-pushed
the
fix/git-bare-head-upstream
branch
from
August 25, 2026 11:23
b64f88e to
45c003f
Compare
Resolve bare HEAD through the shared ref resolver so detached HEAD and reftables are handled consistently. Populate Upstream from git while keeping the remote inventory separate, and document and test the bare repository fields. Fixes JanDeDobbeleer#7799
e-kulikov
force-pushed
the
fix/git-bare-head-upstream
branch
from
August 25, 2026 11:28
45c003f to
bb12e57
Compare
Owner
|
Same with this one, we can reopen. |
This was referenced Aug 26, 2026
Contributor
Author
|
Recreated as #7830, based on This PR closed automatically when Same code, no functional change: the commit's patch-id is unchanged. It still stacks on the directory-role fix, now #7828. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #7799.
Prerequisites
Description
getBareRepoInfo()hand-rolled a HEAD parse that only understoodref: refs/heads/…— a reftablesrepository rendered
.Refas.invalid, and a detached bare HEAD rendered the full 40-characterobject ID with
.Detachedfalse and.Hash/.ShortHashempty, even though the non-bare path alreadyhandles all of this correctly. Separately,
.Upstreamwas assigned the raw, newline-separated outputof
git remote— with two remotes configured, that put a literal line break in the middle of theprompt.
This PR routes bare HEAD interpretation through the same resolver the non-bare path already uses, and
replaces the
.Upstreamassignment with a real upstream/remote-selection lookup, resolving to thebranch's actual upstream (or empty, when none is configured) instead of the remote list. Most of the
directory-selection machinery this originally needed is no longer necessary, since #7798 already makes
the current checkout's git directory correct in every layout this PR touches.
Verified with new tests covering reftables, detached HEAD, single- and multi-remote bare repositories,
and the existing non-bare behaviour, confirmed unchanged.
This is part of a stacked series
This branch adds one commit on top of
fix/git-worktree-common-dir(#7825) and depends on it directly —this PR's simplified HEAD resolution assumes that PR's directory-role fix has already landed. Until
#7825 merges, this PR's diff includes its commit too; it will then shrink to this PR's own commit.