heroku / heroku-repo

Plugin for heroku CLI that can manipulate the repo
MIT License
687 stars 111 forks source link

repo:clone assumes the primary branch is called "master" #101

Open edmorley opened 4 years ago

edmorley commented 4 years ago

Historically when git pushing to Heroku, one always had to use the master branch for the build to be triggered. However it's now possible to git push heroku main as well. (There's also the scenario of the repo only containing a support branch if the app normally uses GitHub sync and has never used git push deploys before).

This plugin hardcodes the branch name of master, meaning that for such repos heroku repo:clone fails with:

$ heroku repo:clone -a <APP>
...
fatal: ambiguous argument 'master': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
 ▸    Command failed: git reset --hard master

See: https://github.com/heroku/heroku-repo/blob/2e531427e15a8a22d959439c4c9188388f77b7f8/commands/clone.js#L26

This caused confusion in: https://heroku.support/912965

Tracked internally at W-8037039.