Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When attempting to make packages from a GitHub repository, lit assumes the deprecated "master" branch #299

Open
rdw-software opened this issue Oct 3, 2021 · 1 comment

Comments

@rdw-software
Copy link
Contributor

GitHub has updated all repositories to use main as their default branch name, but lit seems to always want to access master (and subsequently fails to install the package):

image

I believe this might be the relevant portion of the code:

lit/libs/core.lua

Lines 504 to 505 in 52abe66

"^github://([^/]+)/([^/@]+)/?@(.+)$", "https://github.com/%1/%2/archive/%3.zip",
"^github://([^/]+)/([^/]+)/?$", "https://github.com/%1/%2/archive/master.zip",

I think the problematic flow is as follows:

  1. CLI input of github://SomeUser/SomeRepository is passed to makeUrl (via commands/make.lua)
  2. makeUrl replaces the user and repository name with the above string that hardcodes the master branch
  3. makeUrl assigns the makeHttp handler (due to the https;// prefix of the resulting string)
  4. The handler fetches the unavailable address and fails with a 404 error
  5. Bonus The CLI gets stuck in the event loop instead of exiting (separate issue)

Since people can rename their deployment branch this was never a perfect solution, but now that there are at least the two default branch names to consider it completely breaks down.

Brainstorming ideas for a solution:

  • Request both default URLs and hope one of them exists? (not great)
  • Fetch whatever is the latest release, via GitHub API? (might be complicated)
  • Simply fetch the latest commit (HEAD) instead of a proper release? (seems like a workaround/hack)
  • Something else?
@squeek502
Copy link
Member

Looks like github://SomeUser/SomeRepository@main should be able to be used to specify the branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants