yonaskolb / Mint

A package manager that installs and runs executable Swift packages
MIT License
2.29k stars 123 forks source link

Using `master` when a project has no tags is problematic #236

Open stackotter opened 2 years ago

stackotter commented 2 years ago

It is becoming increasingly common that git repositories use main as the default branch instead of master. If a package has no tags and someone tries to install it using mint, mint only attempts to checkout the master branch which of course fails if the package uses main instead of master.

I think it would be sensible to either just use the repository's default branch (the one that is automatically checked out after git clone [repo] iirc), or add an option to specify a branch when installing a package.

stackotter commented 2 years ago

Whoops, I didn't see #204. It seems like that PR had trouble implementing my first suggested solution. Would it perhaps be easier to attempt the second option? That is: just use master if no tags are found, but allow the user to override the fallback branch with a --fallback-branch option (or something along those lines).