-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Path to receive content from a repository's default branch #26920
Comments
Indirect solution is to query the repo info first. There is a |
We should accept https://github.com/go-gitea/gitea/blob/HEAD/README.md in the branch dropdown, this shows as a commit ref so what GitHub is doing is just resolving the git-native HEAD reference from Trying the same on gitea results in 404. |
Further investigation shows Gitea has distinct URL parts
|
Add support for HEAD in paths: ``` /src/branch/HEAD/README.md /src/commit/HEAD/README.md ``` Closes #26920
…tea#27384) Add support for HEAD in paths: ``` /src/branch/HEAD/README.md /src/commit/HEAD/README.md ``` Closes go-gitea#26920
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
The text was updated successfully, but these errors were encountered: