Skip to content

cargo test suite fails if default branch is not master #8863

Closed
rust-lang/git2-rs
#656
@bk2204

Description

@bk2204

Problem
Running cargo test in the cargo repository fails many tests if the user has set the default branch to something other than master.

Steps

  1. git config --global init.defaultBranch dev
  2. cargo test
  3. Notice failures

Possible Solution(s)
When using Git in a test suite, it's necessary to set HOME to a controlled location and to also set GIT_CONFIG_NOSYSTEM to avoid reading the system configuration file; otherwise, the global or system configuration files can break tests. Cargo probably needs to set these values during setup in the test suite; this is probably not the only configuration option that will have the effect of breaking tests.

Notes

Output of cargo version:

cargo 1.47.0 (f3c7e066a 2020-08-28)

(Note that this is not the version being tested, about which this report is being made.)

Debian GNU Linux amd64/sid, rustc 1.47.0, cargo repository revision 2af662e.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions