Skip to content

Tests fail on systems configured for default branch other than master #2391

@gaige

Description

@gaige

search tried in the issue tracker

git master

describe your issue

While preparing to submit a PR for the solaris issue, I was testing on my desktop which has a default branch of main instead of master. There are a number of tests that use regex to check the output of git commands which fail if the default branch is anything other than master. In a CI environment (for now at least) that's likely to work fine, since the default git branch is main.

I'll submit a PR with a small change to use the --initial-branch=master argument (available in 2.28+) in order to make sure that tests succeed when used on systems that have a different default branch set, or if git changes the default branch name in the future (current documentation warns that the name is subject to change).

The problem can be readily reproduced by using git config to set init.defaultbranch=main

pre-commit --version

pre-commit 2.19.0

.pre-commit-config.yaml

Not specifically relevant to this bug, see the tox tests

~/.cache/pre-commit/pre-commit.log (if present)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions