Submodule link can only work at root #3493

Closed
opened 2025-11-02 05:14:47 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @jacktseng831 on GitHub (Jun 20, 2019).

  • Gitea version (or commit ref): a71cabb
  • Git version: 2.22.0
  • Operating system: Windows Server 2012 R2
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

The submodule link can only work when it's added at the project root directory. If the submodule is added in a directory then Gitea will fail to generate link.

Here is the repo with the submodule added at the "subdir" directory
https://try.gitea.io/jacktseng/submodule_at_subdir

Here is another branch in the same repo but with additional submodule added at root
https://try.gitea.io/jacktseng/submodule_at_subdir/src/branch/trick

You can find in the master branch Gitea doesn't generate the link for the submodule. But in the trick branch, Gitea can generate the link for both the submodule at root and for the one at "subdir".

...

Screenshots

Originally created by @jacktseng831 on GitHub (Jun 20, 2019). <!-- NOTE: If your issue is a security concern, please send an email to security@gitea.io instead of opening a public issue --> <!-- 1. Please speak English, this is the language all maintainers can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/gitea) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): a71cabb - Git version: 2.22.0 - Operating system: Windows Server 2012 R2 - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [x] SQLite - Can you reproduce the bug at https://try.gitea.io: - [x] Yes (provide example URL) - [ ] No - [ ] Not relevant - Log gist: ## Description The submodule link can only work when it's added at the project root directory. If the submodule is added in a directory then Gitea will fail to generate link. Here is the repo with the submodule added at the "subdir" directory https://try.gitea.io/jacktseng/submodule_at_subdir Here is another branch in the same repo but with additional submodule added at root https://try.gitea.io/jacktseng/submodule_at_subdir/src/branch/trick You can find in the **master** branch Gitea doesn't generate the link for the submodule. But in the **trick** branch, Gitea can generate the link for both the submodule at root and for the one at "subdir". ... ## Screenshots <!-- **If this issue involves the Web Interface, please include a screenshot** -->
GiteaMirror added the type/bug label 2025-11-02 05:14:47 -06:00
Author
Owner

@mrsdizzie commented on GitHub (Jun 21, 2019):

The bug seems to be that it doesn't include the full path of the folder when checking to see if there is a matching entry in .gitmodules. It happens to work in the 2nd example because you've also added one at the top level and given them both the same name here, so subdir/sub_moduleRoot is actually just matching the also added path = sub_moduleRoot by coincidence since it is only searching for sub_moduleRoot.

Thank you for test case, hopefully PR should fix it.

@mrsdizzie commented on GitHub (Jun 21, 2019): The bug seems to be that it doesn't include the full path of the folder when checking to see if there is a matching entry in .gitmodules. It happens to work in the 2nd example because you've also added one at the top level and given them both the same name here, so ```subdir/sub_moduleRoot``` is actually just matching the also added ```path = sub_moduleRoot``` by coincidence since it is only searching for ```sub_moduleRoot```. Thank you for test case, hopefully PR should fix it.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#3493