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
main is always used in the pad at Modules tutorial, or
- Implement
branch: and leave commit: unimplemented, or
- Implement both
branch: and commit: (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:
main is hardcoded like this, but modifying it to use a variable like other URL elements should not be so difficult.
This would allow branch: support.
If commit: were to be implemented, it would need to fetch something like commits API to obtain tree.sha first.
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.
|
.replace("src/branch/master", "raw/branch/master"); |
It contains master, but I couldn't find a case that triggers this replace.
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.
The pad currently does not support
branch:andcommit:specifiers in Git modules and always fetches themainbranch.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:
mainis always used in the pad at Modules tutorial, orbranch:and leavecommit:unimplemented, orbranch: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.uaon 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
masterbranch instead ofmain, 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 allow
branch:support.Ifcommit: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
uiua/pad/editor/src/backend.rs
Line 464 in 01c3bcd
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
mainbranch.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.