Skip to content

fix(create): initialize git once for new monorepos - #2417

Merged
fengmk2 merged 6 commits into
voidzero-dev:mainfrom
jong-kyung:fix/create-monorepo-double-git-init
Aug 15, 2026
Merged

fix(create): initialize git once for new monorepos#2417
fengmk2 merged 6 commits into
voidzero-dev:mainfrom
jong-kyung:fix/create-monorepo-double-git-init

Conversation

@jong-kyung

Copy link
Copy Markdown
Collaborator

Description

Creating a new monorepo with vp create vite:monorepo handled git initialization through two separate code paths, which caused three related problems:

  • In verbose interactive mode without --git/--no-git, the user was prompted twice ("Initialize a git repository?" from resolveGitInit, then "Initialize git repository:" inside the monorepo branch).
  • When the two answers differed, the second answer was silently overridden because the later initGitRepository call keyed off the first prompt's result.
  • On the common (compact) path, git init ran twice: once via a direct spawn.sync right after scaffolding and again via initGitRepository after the monorepo rewrite.

Fix

  • Remove the duplicate prompt; resolveGitInit already asks up front before scaffolding.
  • Keep a single initGitRepository call, placed before the hook preflight so shouldSkipStagedMigrationForHooks sees the destination's intended git root (same reasoning as the standalone path).
  • Move the failure warning and stderr output into the shared initGitRepository helper so both the monorepo and standalone paths report a failed git init.

Creating a new monorepo prompted for git initialization twice in
verbose interactive mode and ran `git init` twice on the common path:
once through a direct spawn right after scaffolding and again through
`initGitRepository` after the monorepo rewrite. The second run also
used the first prompt's answer, so answering no to the second prompt
was silently overridden.

Remove the duplicate prompt and keep a single `initGitRepository` call
placed before the hook preflight, matching the standalone path, and
move the failure warning into the shared helper so both paths report
a failed `git init`.
@netlify

netlify Bot commented Aug 11, 2026

Copy link
Copy Markdown

Deploy Preview for viteplus-preview canceled.

Name Link
🔨 Latest commit 7cefbd8
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-preview/deploys/6a800edb86e0da000861398e

@jong-kyung jong-kyung self-assigned this Aug 11, 2026
@jong-kyung

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: b880b1933b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@jong-kyung
jong-kyung marked this pull request as ready for review August 12, 2026 00:07
@jong-kyung
jong-kyung requested a review from fengmk2 August 12, 2026 00:07
@fengmk2 fengmk2 added test: e2e Auto run e2e tests test: create-e2e Run `vp create` e2e tests labels Aug 15, 2026
@fengmk2
fengmk2 merged commit b518dbb into voidzero-dev:main Aug 15, 2026
98 checks passed
@jong-kyung
jong-kyung deleted the fix/create-monorepo-double-git-init branch August 15, 2026 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test: create-e2e Run `vp create` e2e tests test: e2e Auto run e2e tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants