Skip to content

fix(cli): surface git output when initial commit fails#1819

Open
fengmk2 wants to merge 2 commits into
mainfrom
fix/surface-initial-commit-failure-output
Open

fix(cli): surface git output when initial commit fails#1819
fengmk2 wants to merge 2 commits into
mainfrom
fix/surface-initial-commit-failure-output

Conversation

@fengmk2

@fengmk2 fengmk2 commented Jun 11, 2026

Copy link
Copy Markdown
Member

Problem

When the initial commit fails during vp create --git, the warning always says "Check your git user.name/user.email config" even when the failure has nothing to do with git identity (e.g. a failing pre-commit hook). The actual git error is discarded, making the failure hard to diagnose.

Fix

createInitialCommit now returns the combined stdout/stderr of git commit, and both call sites print it under the Initial commit failed warning. When identity is the real problem, git's own message is shown verbatim.

Adds a snap test (create-git-commit-fail) that scaffolds the builtin vite:monorepo template offline and forces a deterministic pre-commit hook failure via GIT_CONFIG_* env vars, locking in the surfaced output.


Note

Low Risk
CLI-only UX and return-type change for initial commit; no auth or data-path changes, covered by a snap test.

Overview
When vp create --git cannot create the initial commit, the CLI no longer assumes a user.name/user.email problem. createInitialCommit now returns success plus combined git commit stdout/stderr, and both create flows print that text under a short Initial commit failed warning.

A new snap test (create-git-commit-fail) forces a failing pre-commit hook via core.hooksPath and asserts the hook message appears while .git is still created.

Reviewed by Cursor Bugbot for commit b83cfd2. Configure here.

The warning always suggested checking git user.name/user.email even when
the commit failed for other reasons (e.g. a failing pre-commit hook).
Show the actual git commit output instead, and add a snap test covering
the failure path.
@fengmk2 fengmk2 self-assigned this Jun 11, 2026
@netlify

netlify Bot commented Jun 11, 2026

Copy link
Copy Markdown

Deploy Preview for viteplus-preview canceled.

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

The bundled org fixture (mock registry, manifest, tarball) is not needed
to exercise the initial-commit failure path. The builtin template runs
fully offline and shrinks the fixture to steps.json plus the hook.
@fengmk2 fengmk2 requested review from cpojer and wan9chi June 12, 2026 02:33
@fengmk2 fengmk2 marked this pull request as ready for review June 12, 2026 02:33
@fengmk2

fengmk2 commented Jun 12, 2026

Copy link
Copy Markdown
Member Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit b83cfd2. Configure here.

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