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

Clean up/refactor git configuration #7538

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

saltedcoffii
Copy link
Collaborator

@saltedcoffii saltedcoffii commented Oct 24, 2022

Description

This is a small little refactor for our git clone code.
Changes:

  • Add --quiet to git init to suppress the new warning about branch names
  • Include a new .gitconfig file instead of manually configuring each repository

Additional information

Works properly:

  • x86_64
  • i686
  • armv7l

Run the following to get this pull request's changes locally for testing.

CREW_TESTING_REPO=https://github.com/saltedcoffii/chromebrew.git CREW_TESTING_BRANCH=git-opts CREW_TESTING=1 crew update

.crew-gitconfig Outdated Show resolved Hide resolved
system 'git init'
system 'git config advice.detachedHead false'
system 'git config init.defaultBranch master'
system 'git init --quiet', exception: true # use --quiet to suppress default branch name warning
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not a fan of quiet. Hiding stuff is not what I prefer.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There is no other way to hide this:

Performing pre-flight checks...
No precompiled binary available for your platform, downloading source...
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint: 
hint: 	git config --global init.defaultBranch <name>
hint: 
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint: 
hint: 	git branch -m <name>

Copy link
Collaborator

Choose a reason for hiding this comment

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

Have you tried git config --global init.defaultBranch master? That should make the message go away.

Copy link
Member

Choose a reason for hiding this comment

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

We should probably start setting git config --global init.defaultBranch main since that's becoming the new norm...

Copy link
Member

Choose a reason for hiding this comment

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

Can we get rid of line 775 and merge this?
The git config line in line 776 should in theory make this message go away, no?

Copy link
Collaborator

@uberhacker uberhacker left a comment

Choose a reason for hiding this comment

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

If you push up another commit on this PR branch, it should fire another workflow run; hopefully without errors.

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.

None yet

3 participants