File tree Expand file tree Collapse file tree 3 files changed +21
-18
lines changed
packages/create-cloudflare/src Expand file tree Collapse file tree 3 files changed +21
-18
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " create-cloudflare " : patch
3+ ---
4+
5+ fix: make sure to always warn developers trying to use git when their git instance is not properly configured
Original file line number Diff line number Diff line change @@ -149,8 +149,8 @@ describe("git helpers", () => {
149149 test ( "happy path" , async ( ) => {
150150 const ctx = createTestContext ( ) ;
151151 mockGitInstalled ( true ) ;
152- mockGitConfig ( ) ;
153152 mockInsideGitRepo ( false ) ;
153+ mockGitConfig ( ) ;
154154 mockDefaultBranchName ( ) ;
155155
156156 // Mock user selecting true
Original file line number Diff line number Diff line change @@ -26,21 +26,6 @@ export const offerGit = async (ctx: C3Context) => {
2626 return ; // bail early
2727 }
2828
29- const gitConfigured = await isGitConfigured ( ) ;
30- if ( ! gitConfigured ) {
31- // haven't prompted yet, if provided as --git arg
32- if ( ctx . args . git ) {
33- updateStatus (
34- "Must configure `user.name` and user.email` to use git. Continuing without git." ,
35- ) ;
36- }
37-
38- // override true (--git flag) and undefined (not prompted yet) to false (don't use git)
39- ctx . args . git = false ;
40-
41- return ; // bail early
42- }
43-
4429 const insideGitRepo = await isInsideGitRepo ( ctx . project . path ) ;
4530
4631 if ( insideGitRepo ) {
@@ -55,9 +40,22 @@ export const offerGit = async (ctx: C3Context) => {
5540 defaultValue : C3_DEFAULTS . git ,
5641 } ) ;
5742
58- if ( ctx . args . git ) {
59- await initializeGit ( ctx . project . path ) ;
43+ if ( ! ctx . args . git ) {
44+ return ;
45+ }
46+
47+ const gitConfigured = await isGitConfigured ( ) ;
48+ if ( ! gitConfigured ) {
49+ updateStatus (
50+ "Must configure `user.name` and user.email` to use git. Continuing without git." ,
51+ ) ;
52+
53+ // override ctx.args.git to false (don't use git)
54+ ctx . args . git = false ;
55+ return ;
6056 }
57+
58+ await initializeGit ( ctx . project . path ) ;
6159} ;
6260
6361export const gitCommit = async ( ctx : C3Context ) => {
You can’t perform that action at this time.
0 commit comments