Correct loading of git submodule image references
Release notes
Image file paths of git submodules are resolved in gitlab and images are displayed in markdown (.md) files
Problem to solve
Gitlab is not able to use the reference, to a git submodule, load images from a submodule into the markdown file of the main project.
Git-repository setup:
submodule stand alone after git clone on the client:
+--submodule
|+--images
|+--graphs
||+--important_graph.png
main project after git clone --recurse-submodules on the client:
+--main_project
|+--some_folder
||--README.md
|+--submodule
||+--images
||+--graphs
|||+--important_graph.png
Problem: Now I reference the "important_graph.png" in the README.md of the min project like this:
README.md:
This is the Readme file of the Main project.

The important graph shows .....
......
Inside an ide (like Intellij) the README.md of the main project shows the important_graph.png from the submodule project. Gitlab does not show the graph in the README.md. It only shows a link to "/main_project/-/blob/main/submodule/important_graph.png". this link does not work, and the .png-file is not shown in the README.md.
Intended users
- Parker (Product Manager)
- Delaney (Development Team Lead)
- Presley (Product Designer)
- Sasha (Software Developer)
- Eddie (Content Editor)
Metrics
User experience goal
The user should be able to reference images(.png; .svg; ...) in the main git project to show up in markdown files, from a git submodule, in "system path style", without thinking about where the submodule project actually is.
Proposal
The main project shows the submodule folder as two links.
Shown as <git_project_name> @ <commit_sha> for example submoduel @ 2d4f6ec9
The fist one only leads to the default branch of the submodule <gitlab-adress>/submodule/.
The second one leads to the submodule repository at the specific commit/version,
which was checked out with the main_project as it was pushed to Gitlab <gitlab-adress>/submodule/-/tree/2d4f6ec9........
The proposed solution is that Gitlab recognises that the path submodule in the markdown file does not lead to <gitlab-adress>/main_project/-/blob/main/submodule/important_graph.png but instead to
<gitlab-adress>/submodule/-/raw/<sha-key>/graphs/important_graph.png.
This would lead to a correct shown "important_graph.png" in the README.md of the main_project.
Further details
When this works you can reference the same git submodule in multiple main Projects and use the existing images of the subproject in the different main projects for different documents/purposes.
Permissions and Security
Documentation
Availability & Testing
Available Tier
- Free
This should be in the free Tier because it is setting correct references for a git standard feature.
What does success look like, and how can we measure that?
Success shows the picture with the normal path annotation in tha markdown file of the main project.
What is the type of buyer?
Everyone who wants to use git subprojects with image references properly