Skip to content
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

URL to tag goes to branch if they have the same name #7936

Closed
2 of 7 tasks
davidsvantesson opened this issue Aug 22, 2019 · 2 comments · Fixed by #8899
Closed
2 of 7 tasks

URL to tag goes to branch if they have the same name #7936

davidsvantesson opened this issue Aug 22, 2019 · 2 comments · Fixed by #8899
Labels
type/enhancement An improvement of existing functionality
Milestone

Comments

@davidsvantesson
Copy link
Contributor

  • Gitea version (or commit ref): 1.10.0+dev-198-g111d31d68
  • Git version:
  • Operating system:
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant

Description

When a branch and a tag has the same name, entering the URL to the tag shows the branch instead.

Example: https://try.gitea.io/merle_noir/TestName/src/tag/BranchAndTagNameSame is URL to tag but it shows the content of the branch with the same name.

@davidsvantesson davidsvantesson changed the title Tag URL goes to branch if they have the same name URL to tag goes to branch if they have the same name Aug 22, 2019
@lunny
Copy link
Member

lunny commented Aug 22, 2019

What do you think the proper behaviour?

@davidsvantesson
Copy link
Contributor Author

Expected behavior:

  • {Repo}/src/branch/{refname}: 404 if branch {refname} doesn't exist. If exist show branch.
  • {Repo}/src/tag/{refname}: 404 if tag {refname} doesn't exist. If exist show tag.

Actual behavior:

  • {Repo}/src/branch/{refname}: 404 if branch {refname} doesn't exist. If exist show branch.
  • {Repo}/src/tag/{refname}: 404 if tag {refname} doesn't exist. If exist show branch (in first case, if it exist) otherwise show tag.

The reason for this is in /modules/context/repo.go, func RepoRefByType, the code first correctly determines if the branch or tag exist (depending on what is requested), but then first check if branch exist (line 610) regardless if branch or tag was requested.

@lunny lunny added the type/proposal The new feature has not been accepted yet but needs to be discussed first. label Aug 23, 2019
@lafriks lafriks added type/enhancement An improvement of existing functionality and removed type/proposal The new feature has not been accepted yet but needs to be discussed first. labels Nov 12, 2019
@lafriks lafriks added this to the 1.11.0 milestone Nov 12, 2019
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants