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

Add git submodules support to github linking #1270

Merged
merged 2 commits into from
Jul 31, 2019
Merged

Add git submodules support to github linking #1270

merged 2 commits into from
Jul 31, 2019

Conversation

mourner
Copy link
Contributor

@mourner mourner commented Jul 31, 2019

The PR adds support for generating github links when running documentation on a git submodule (rather than a standalone repo). As an example, this will enable cutting out GL JS docs into its own repo that pulls mapbox-gl-js source as a submodule.

I had to do some refactoring to support this — e.g. findGit will now return two values, one pointing to the repo root, and the other one to the .git folder, which for a submodule will look like parent_repo/.git/modules/foo rather than repo/.git (we can't derive the root from the latter).

@mourner mourner requested a review from tmcw July 31, 2019 21:06
const parsed = gitUrlParse(getRemoteOrigin.sync(root));
let origin;
if (git.indexOf(root) === 0) {
const config = ini.parse(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For documentation.js's purposes this probably isn't important, but git configuration is a little different than ini and the underlying parse-git-config module did a find/replace to preprocess it so it would work as an ini.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, good point! I did have parse-git-config here first, but then I upgraded its version to the latest and everything broke, and I didn't have enough patience to get to the bottom of it, so wrote without a dep instead. Will make sure it doesn't break when submodule name contains dots, and if it is, I'll submit another PR. Thanks!

@tmcw tmcw merged commit ec36b41 into master Jul 31, 2019
@tmcw
Copy link
Member

tmcw commented Jul 31, 2019

Published in 12.1.0. Thanks @mourner!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants