Skip to content
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

Respect git global config for a default branch #207

Merged
merged 3 commits into from
Aug 13, 2021
Merged

Respect git global config for a default branch #207

merged 3 commits into from
Aug 13, 2021

Conversation

SamAsEnd
Copy link
Contributor

Git provides a global configuration to override the default branch when a new repository is initialized.
Even though laravel/installer provides a way to override the default branch name, laravel/installer does respect git global configurations.

init.defaultBranch:- Allows overriding the default branch name e.g. when initializing a new repository.

init.defaultBranch:- Allows overriding the default branch name e.g. when initializing a new repository.
https://git-scm.com/docs/git-config#Documentation/git-config.txt-initdefaultBranch
@SamAsEnd
Copy link
Contributor Author

git config --global

Git

laravel/installer respecting git config --global

laravel/installer

@taylorotwell
Copy link
Member

Thanks for your pull request to Laravel!

Unfortunately, I'm going to delay merging this code for now. To preserve our ability to adequately maintain the framework, we need to be very careful regarding the amount of code we include.

If possible, please consider releasing your code as a package so that the community can still take advantage of your contributions!

If you feel absolutely certain that this code corrects a bug in the framework, please "@" mention me in a follow-up comment with further explanation so that GitHub will send me a notification of your response.

@SamAsEnd
Copy link
Contributor Author

@taylorotwell This is not a "feature" I can release as a package.

Laravel installer SHOULD respect my git global configuration for my "master/main" branch.

Otherwise I'm forced to always pass the branch argument which is not nessasery.

Please, respect git configuration
@driesvints @themsaid

@taylorotwell
Copy link
Member

How does this PR behave if Git isn't installed?

@taylorotwell taylorotwell reopened this Aug 13, 2021
src/NewCommand.php Outdated Show resolved Hide resolved
@SamAsEnd
Copy link
Contributor Author

How does this PR behave if Git isn't installed?

It will default to main since the process will fail.


$output = trim($process->getOutput());

return $process->isSuccessful() && $output ? $output : 'main';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@taylorotwell If the process is not successful, it will default to main

@taylorotwell taylorotwell merged commit f655b9d into laravel:master Aug 13, 2021
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.

3 participants