Skip to content

fix(git): check out the declared branch after clone+submodule registration - #16

Merged
log0u7 merged 1 commit into
mainfrom
fix/clone-branch-checkout
Oct 14, 2026
Merged

log0u7 merged 1 commit into
mainfrom
fix/clone-branch-checkout

Conversation

@log0u7

@log0u7 log0u7 commented Oct 14, 2026

Copy link
Copy Markdown
Owner

Issue for this PR

Found while standing up the myvim CI: a fresh install left coc.nvim on its
default branch (build/index.js not found) even though the vimrc declares
{'branch': 'release'}. The async batch path pre-clones without -b, and
git submodule add -b only records the branch in .gitmodules for later
updates - the worktree HEAD stays wherever the pre-clone put it.

Changes

  • git#add_submodule: after the submodule registration, check out the
    declared branch (reuses s:checkout_version, same precedence as
    commit/tag pins).
  • tests/branch_clone.vader: sync path + pre-cloned worktree (the async
    shape) both assert the declared branch is checked out and its content
    present.

Tests (mandatory)

Red-green: tests/branch_clone.vader "branch checkout applies to a
pre-cloned worktree" fails before the fix (HEAD stays on the default
branch) and passes after. Full suite: 218/219 locally (the 1 local failure,
lazy.vader E216, pre-exists on main and passes in CI).

Linked Issue

Refs the myvim CI rollout (log0u7/repo-template).

…ation

git submodule add -b records the branch for update --remote, but the
worktree pre-cloned by the async batch path stays on the default branch
(coc.nvim only ships its compiled dist on the release branch). Covered
by tests/branch_clone.vader (sync path, pre-cloned worktree).
@log0u7
log0u7 merged commit 55415ed into main Oct 14, 2026
32 checks passed
@log0u7
log0u7 deleted the fix/clone-branch-checkout branch October 14, 2026 06:55
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.

1 participant