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

Stop printing pointless git default branch warning into logs/tests #8632

Conversation

jeffwidman
Copy link
Member

@jeffwidman jeffwidman commented Dec 16, 2023

While running the go_modules tests, I noticed that the git warning about an unspecified default branch was being repeatedly thrown in tests.

Originally I assumed it was a bad test fixture setup (similar to @deivid-rodriguez 's fixes in #8100 / #8113), but I tracked it down to here which appears to run in production... so it may be filling production logs in addition to CI logs.

Before adding this line:

[dependabot-core-dev] ~/go_modules $ rspec ./spec/dependabot/go_modules/file_updater_spec.rb:179

Randomized with seed 30583
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>
.

Finished in 1.32 seconds (files took 0.56 seconds to load)
1 examples, 0 failures

Randomized with seed 30583

After adding this:

[dependabot-core-dev] ~/go_modules $ rspec ./spec/dependabot/go_modules/file_updater_spec.rb:179

Randomized with seed 51472
.

Finished in 1.24 seconds (files took 0.53 seconds to load)
1 examples, 0 failures

Randomized with seed 51472

@jeffwidman jeffwidman requested a review from a team as a code owner December 16, 2023 06:36
@github-actions github-actions bot added the L: go:modules Golang modules label Dec 16, 2023
While running the `go_modules` tests, I noticed that the `git` warning
about an unspecified default branch was being repeatedly thrown in
tests.

Originally I assumed it was a bad test fixture setup, but I tracked it
down to here... so it may be filling production logs in addition to CI
logs.

Before adding this line:
```
[dependabot-core-dev] ~/go_modules $ rspec ./spec/dependabot/go_modules/file_updater_spec.rb

Randomized with seed 30583
...................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>
.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>
.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>
.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>
.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>
.

Finished in 21.32 seconds (files took 2.56 seconds to load)
24 examples, 0 failures

Randomized with seed 30583
```

After adding this:
```
[dependabot-core-dev] ~/go_modules $ rspec ./spec/dependabot/go_modules/file_updater_spec.rb

Randomized with seed 51472
........................

Finished in 22.24 seconds (files took 3.53 seconds to load)
24 examples, 0 failures

Randomized with seed 51472
```
@jeffwidman jeffwidman force-pushed the stop-printing-pointless-git-warning-into-logs-and-tests branch from 25ec5e7 to 47bab6c Compare December 18, 2023 22:37
Copy link
Member

@jakecoffman jakecoffman left a comment

Choose a reason for hiding this comment

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

Thanks Jeff!

@jakecoffman jakecoffman merged commit 961c875 into dependabot:main Dec 19, 2023
75 checks passed
@jeffwidman jeffwidman deleted the stop-printing-pointless-git-warning-into-logs-and-tests branch December 19, 2023 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L: go:modules Golang modules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants