Problem
The remote URLs generated by sphinx-codelinks for the coffee-machine implementation needs contain None instead of the actual git commit hash.
Example broken link:
https://github.com/useblocks/sphinx-needs-demo/blob/None/crates/coffee-machine/src/interfaces.rs#L8
Expected link:
|
// @ BrewStrength enum, IMPL_BREW_STRENGTH, impl, [SWREQ_BREW_STRENGTH] |
Visible on the live docs:
https://sphinx-needs-demo.readthedocs.io/en/latest/coffee-machine/index.html#implementation
Root Cause
The remote_url_pattern in docs/ubproject.toml uses the {commit} placeholder:
[codelinks.projects.coffee_machine]
remote_url_pattern = "https://github.com/useblocks/sphinx-needs-demo/blob/{commit}/{path}#L{line}"
sphinx-codelinks auto-detects the git root by traversing parent directories to find a .git folder. This likely fails in the ReadTheDocs build environment because src_dir = "../crates" points outside the docs directory, and the .git directory may not be accessible or detectable from the build working directory.
When git root detection fails, the commit hash resolves to None.
Suggested Fix
Explicitly set the git_root option in the analyse config so that sphinx-codelinks can reliably find the git repository:
[codelinks.projects.coffee_machine.analyse]
git_root = "../" # Point to repo root relative to docs/
get_need_id_refs = false
get_oneline_needs = true
comment_type = "rust"
See sphinx-codelinks docs on git_root for details.
Problem
The remote URLs generated by
sphinx-codelinksfor the coffee-machine implementation needs containNoneinstead of the actual git commit hash.Example broken link:
https://github.com/useblocks/sphinx-needs-demo/blob/None/crates/coffee-machine/src/interfaces.rs#L8
Expected link:
sphinx-needs-demo/crates/coffee-machine/src/interfaces.rs
Line 8 in cb0f12b
Visible on the live docs:
https://sphinx-needs-demo.readthedocs.io/en/latest/coffee-machine/index.html#implementation
Root Cause
The
remote_url_patternindocs/ubproject.tomluses the{commit}placeholder:sphinx-codelinksauto-detects the git root by traversing parent directories to find a.gitfolder. This likely fails in the ReadTheDocs build environment becausesrc_dir = "../crates"points outside the docs directory, and the.gitdirectory may not be accessible or detectable from the build working directory.When git root detection fails, the commit hash resolves to
None.Suggested Fix
Explicitly set the
git_rootoption in the analyse config so thatsphinx-codelinkscan reliably find the git repository:See sphinx-codelinks docs on
git_rootfor details.