-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
create-turbo: automatic git configuration. #4941
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,7 +51,6 @@ export function isInMercurialRepository(): boolean { | |
export function tryGitInit(root: string, message: string): boolean { | ||
let didInit = false; | ||
try { | ||
execSync("git --version", { stdio: "ignore" }); | ||
if (isInGitRepository() || isInMercurialRepository()) { | ||
return false; | ||
} | ||
|
@@ -61,10 +60,7 @@ export function tryGitInit(root: string, message: string): boolean { | |
|
||
execSync("git checkout -b main", { stdio: "ignore" }); | ||
|
||
execSync("git add -A", { stdio: "ignore" }); | ||
execSync(`git commit -m "${message}"`, { | ||
stdio: "ignore", | ||
}); | ||
gitCommit(message); | ||
return true; | ||
} catch (err) { | ||
if (didInit) { | ||
|
@@ -78,12 +74,18 @@ export function tryGitInit(root: string, message: string): boolean { | |
|
||
export function tryGitCommit(message: string): boolean { | ||
try { | ||
execSync("git add -A", { stdio: "ignore" }); | ||
execSync(`git commit -m "${message}"`, { | ||
stdio: "ignore", | ||
}); | ||
gitCommit(message); | ||
return true; | ||
} catch (err) { | ||
return false; | ||
} | ||
} | ||
|
||
function gitCommit(message: string) { | ||
execSync( | ||
`git commit --author="Turbobot <turbobot@vercel.com>" -am "${message}"`, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hardcodes the automated commits to be from us: |
||
{ | ||
stdio: "ignore", | ||
} | ||
); | ||
} | ||
Comment on lines
+84
to
+91
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Factored out into a separate method so you get either the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is unnecessary; just a bonus place where weird errors can creep in.