-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Link to tree views of submodules if possible #33424
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
Conversation
When linking a submodule at a commit in either the repo view, or a diff when adding a new submodule, link to the tree view of that submodules intead of the individual commit. This shows the user the full tree, instead of the diff of the commit. This makes the assumption that the tree for a given SHA is at `<repo_url>/tree/<sha>`. This URL format is supported by both Github & Gitlab, but not Gitea. To fix this, add a redirect from `<username>/<repo>/tree/<ref>` to `<username>/<repo>/src/<ref>`.
Thank you for the update, but I think we should avoid doing that .....
If you don't mind, I can help to make some improvements. |
Was in the process of responding to that one. I'm happy to make the change if you want, but before using If you still want me to replace it with fmt.Sprintf, I can. |
That's the only (maybe a few) legacy usages. Most other code doesn't use Actually, you could also just use |
Used this method in 92cb2a8
This is correct, but intentional. Github's URL structure is
When hitting this in Gitea, the user will have two separate redirects to get to the canonical URL. The flow would look like this: |
Then it comes to this question .... #33424 (comment) Why we should support such |
The intent of this PR is so that when a user clicks on a submodule commit, either in the repo home view, or when adding a new submodule in a diff, that shows them the tree instead of the commit. Right now if I add a submodule of The issue of adding a We could try to guess what type of forge a given submodule links out to, and then either use |
Thank you for the explanation, it's clear to me now. I think we need to add the background information to comments, otherwise the future readers would still have the same question: why |
I updated the comment in 7da9b01. Is that inline with what you are thinking? |
-> Fix "redirect link" handling #33440 Improved the path handling logic and added some tests in |
This is a follow-up to #33097.
When linking a submodule at a commit in either the repo view, or a diff when adding a new submodule, link to the tree view of that submodules intead of the individual commit. This shows the user the full tree, instead of the diff of the commit.
This makes the assumption that the tree for a given SHA is at
<repo_url>/tree/<sha>
. This URL format is supported by both Github & Gitlab, but not Gitea. To fix this, add a redirect from<username>/<repo>/tree/<ref>
to<username>/<repo>/src/<ref>
, so that Gitea can support this URL structure.