Suggestion for Pad and Git modules
The pad currently does not support branch: and commit: specifiers in Git modules and always fetches the main branch.
I am happy with it, however I can't seem to find explicit documentation stating that the pad always tries main.
I propose one of the following:
- Mention that
mainis always used in the pad at Modules tutorial, or - Implement
branch:and leavecommit:unimplemented, or - Implement both
branch:andcommit:~(looks complex)~.
I can submit a PR for (1), (2), or (3) if this is something you'd like to see.
Why?
I initially wanted to load lib.ua on GitHub Gist in the pad (and later found that it wasn't so easy).
While trying, I loaded every module in Uiua modules inside the pad and noticed that amatgil/steal-gift throws an error with 404.
This is because the repository uses master branch instead of main, which wasn't obvious to me until I checked the code.
Looking at the source code, I found:
-
mainis hardcoded like this, but modifying it to use a variable like other URL elements should not be so difficult. This would allowbranch:support. - ~If
commit:were to be implemented, it would need to fetch something like commits API to obtaintree.shafirst. This would be a complex change.~ I realized I can use commit hash in place of branch name - (Question) I'm not sure what this line does.
https://github.com/uiua-lang/uiua/blob/01c3bcd7c0a9badd91f89a5e6665a65ee1511b87/pad/editor/src/backend.rs#L464
It contains
master, but I couldn't find a case that triggers thisreplace. I think this line could be removed.
Summary
I propose updating the docs to state that the pad always fetches main branch.
I also found a way to support branch:, if that's of interest.
Afterthoughts: I forgot that this was specific to GitHub. If these changes are to be included, the document should also state it.