Skip to content

relative submodule PR diff links not working #35054

Open
@AdamMajer

Description

@AdamMajer

Description

This is a followup for #35033 and related to the FIXME in sources:

// FIXME: when handling relative path, this logic is not right. It needs to:
// 1. Remember the submodule's full path and its commit's repo home link
// 2. Resolve the relative path: targetRepoLink = path.Join(repoHomeLink, path.Dir(submoduleFullPath), refURL)
// Not an easy task and need to refactor related code a lot.

When submodule uses relative repository paths, the submodule diff link in a PR is invalid, for example,

https://demo.gitea.com/gnuman/rel_submodule_test/pulls/1/files

lists the diff as:
https://demo.gitea.com/gnuman/rel_submodule_test/gnuman/foo.git/compare/1890948776e76bdb05f4b55acc6c035143d3fbce...e16d0fe2f699d9855e381a792e83ed3e7e134e52

instead of
https://demo.gitea.com/gnuman/foo.git/compare/1890948776e76bdb05f4b55acc6c035143d3fbce...e16d0fe2f699d9855e381a792e83ed3e7e134e52

and the submodule link is also invalid in the PR as:
https://demo.gitea.com/gnuman/rel_submodule_test/gnuman/foo.git

Gitea Version

main

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

demo.gitea.com

Database

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions