-
-
Notifications
You must be signed in to change notification settings - Fork 6k
Description
Feature Description
(This has been discussed a little on the discord server)
There can be situations where you want to obtain content of a repository, but don't know the name of its default branch.
As an example, if I want to display a user profile readme in an app would I first need to obtain the repository to then get the default branch from and finally the file. This can waste API calls which, especially when unauthorized, could be somewhat limited depending on what other API requests are peformed and how frequent.
Another example could be a repository where you update the default branch whenever a new major release of your project is released, which would cause old URLs to break (Should you not keep them) or link to possible outdated sources, requiring you to update them.
With this feature could you keep the same URL and it would automatically redirect to the right file on the default branch.
Regarding the "name" of the branch would I go with ~
as it works in browsers and can't be used in a branch name itself, making it a perfect candidate to have for this function, without overriding any existing branch names a user may have.
As an example, assume a repository having a branch labeled main
. Using {user}/{repo}/src/branch/~/README.md
would be equal to {user}/{repo}/src/branch/main/README.md
.
If the repo now has its default renamed to default
would {user}/{repo}/src/branch/~/README.md
now be equal to {user}/{repo}/src/branch/default/README.md
Screenshots
No response