<script> tag what CDN URL)npm i isomorphic-git and use git.clone()Git allows relative URL in .gitmodules.
Here is an example.
[submodule "child"]
path = child
url = ../submodule-test-child
The relative URL allows to specify submodule repository regardless of scheme (ssh, https).
$ git clone --recursive [email protected]:tyru/submodule-test.git ssh-test
$ (cd ssh-test/child && git remote -v)
origin [email protected]:tyru/submodule-test-child (fetch)
origin [email protected]:tyru/submodule-test-child (push)
$ git clone --recursive https://github.com/tyru/submodule-test https-test
$ (cd https-test/child && git remote -v)
origin https://github.com/tyru/submodule-test-child (fetch)
origin https://github.com/tyru/submodule-test-child (push)
$ node index.js
index.js
(async function () {
const git = require('isomorphic-git');
const fs = require('fs');
const repo = {fs, dir: 'submodule-test'}
const result = await git.clone({
...repo,
url: 'https://github.com/tyru/submodule-test',
})
console.log('done', result)
})();
$ node index.js
(node:818) UnhandledPromiseRejectionWarning: ReadObjectFail: Failed to read git object with oid 3c2100b37a460cbc66a4d54b7cbed06ab1c4b14c
at Function.read (/home/tyru/git/jsgit/node_modules/isomorphic-git/dist/for-node/isomorphic-git/index.js:1518:13)
at <anonymous>
(node:818) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:818) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
$ ls -A submodule-test/ # no 'child' sub-repository
.git .gitmodules README.md
git.clone() succeeds with no UnhandledPromiseRejectionWarning.First things first, we need to add submodule support. It's not just relative URLs that's broken, it's any kind of submodule.
Any progress here?
Not yet! Submodules just haven't made it to the top of my todo list.
Why not add an option to disable submodule and avoid this message TODO: submodule support still needs to be implemented!. Sometimes submodule are not necessary.
Most helpful comment
First things first, we need to add submodule support. It's not just relative URLs that's broken, it's any kind of submodule.