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

Git tests fail if git defaultBranch config setting is not set to 'master' #118

Open
djerius opened this issue Sep 14, 2022 · 4 comments
Open

Comments

@djerius
Copy link

djerius commented Sep 14, 2022

In my .gitconfig, I have set

[init]
	defaultBranch = main

which causes tests assuming the default branch is called master to fail, e.g.:

    #   Failed test 'master -> master'
    #   at /home/dj/.cpanm/work/1663196190.2607250/Code-TidyAll-0.82/t/lib/TestFor/Code/TidyAll/Git.pm line 105.
    #   (in TestFor::Code::TidyAll::Git->test_git)
    #                   'remote: 1 file did not pass tidyall check        
    # remote: [checked] foo.txt        
    # remote: *** needs tidying        
    # To /tmp/Code-TidyAll-avES/shared
    #  ! [remote rejected] main -> main (pre-receive hook declined)
    # error: failed to push some refs to '/tmp/Code-TidyAll-avES/shared'
    # '
    #     doesn't match '(?^:master -> master)'
    # Looks like you failed 1 test of 4.
@autarch
Copy link
Member

autarch commented Sep 16, 2022

Hi @djerius, thanks for the bug report. I'm not doing a lot of work on tidyall these days but I'd be happy to review a PR to fix this.

@eserte
Copy link

eserte commented Feb 3, 2023

Not sure if this true for all git versions, but git in debian:11 (bullseye) (git version 2.30.2) is using the "main" branch by default. Consequently this test is also failing there.

@djerius
Copy link
Author

djerius commented Feb 3, 2023

see #122

@kcaran
Copy link

kcaran commented Jul 29, 2024

I just ran into this on my macbook. I edited t/lib/TestFor/Code/TidyAll/Git.pm and replaced master with main and everything worked. I tried djerius's branch but it failed as well.

$git --version
git version 2.39.3 (Apple Git-145)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants