Skip to content

cargo install --git hardcodes master, doesn't use the default remote branch (HEAD) #8380

@sunshowers

Description

@sunshowers

Problem

cargo install --git uses the master branch by default. A better default would be to use the default remote branch (aka HEAD), which is typically master but more people have been setting to other names recently.

Steps

cargo install --git https://github.com/sunshowers/non-master-branch

The output is:

    Updating git repository `https://github.com/sunshowers/non-master-branch`error: failed to find branch `master`

Caused by:
  cannot locate local branch 'master'; class=Reference (4); code=NotFound (-3)

Possible Solution(s)

  • Use the default remote branch (a minor BC breakage, but I'd be surprised if it broke anyone).
  • If the BC breakage is too severe, at least warn about this.

Notes

Output of cargo version:

cargo 1.44.0 (05d080faa 2020-05-06)

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions