release icon indicating copy to clipboard operation
release copied to clipboard

git sub-module support

Open jasonkuhrt opened this issue 7 years ago • 8 comments

Does not work if the repo is a git submodule.

TypeError: path must be a string or Buffer
    at TypeError (native)
    at Object.fs.stat (fs.js:973:11)
    at parse (/Users/jason.kuhrt/projects/ssense/ws-website/services/ui-website/node_modules/parse-git-config/index.js:47:6)
    at Function.originUrl (/Users/jason.kuhrt/projects/ssense/ws-website/services/ui-website/node_modules/remote-origin-url/index.js:24:3)
    at module.exports (/Users/jason.kuhrt/projects/ssense/ws-website/services/ui-website/node_modules/git-repo-name/index.js:15:9)
    at resolve (/Users/jason.kuhrt/projects/ssense/ws-website/services/ui-website/node_modules/release/lib/repo.js:10:3)
    at exports.getRepo (/Users/jason.kuhrt/projects/ssense/ws-website/services/ui-website/node_modules/release/lib/repo.js:9:25)
    at /Users/jason.kuhrt/projects/ssense/ws-website/services/ui-website/node_modules/release/bin/release.js:215:23
    at next (native)
    at tryCatcher (/Users/jason.kuhrt/projects/ssense/ws-website/services/ui-website/node_modules/release/node_modules/bluebird/js/release/util.js:16:23)
    at PromiseSpawn._promiseFulfilled (/Users/jason.kuhrt/projects/ssense/ws-website/services/ui-website/node_modules/release/node_modules/bluebird/js/release/generators.js:97:49)
    at Promise._settlePromise (/Users/jason.kuhrt/projects/ssense/ws-website/services/ui-website/node_modules/release/node_modules/bluebird/js/release/promise.js:572:26)
    at Promise._settlePromise0 (/Users/jason.kuhrt/projects/ssense/ws-website/services/ui-website/node_modules/release/node_modules/bluebird/js/release/promise.js:612:10)
    at Promise._settlePromises (/Users/jason.kuhrt/projects/ssense/ws-website/services/ui-website/node_modules/release/node_modules/bluebird/js/release/promise.js:691:18)
    at Async._drainQueue (/Users/jason.kuhrt/projects/ssense/ws-website/services/ui-website/node_modules/release/node_modules/bluebird/js/release/async.js:133:16)
    at Async._drainQueues (/Users/jason.kuhrt/projects/ssense/ws-website/services/ui-website/node_modules/release/node_modules/bluebird/js/release/async.js:143:10)
    at Immediate.Async.drainQueues (/Users/jason.kuhrt/projects/ssense/ws-website/services/ui-website/node_modules/release/node_modules/bluebird/js/release/async.js:17:14)
    at runCallback (timers.js:637:20)
    at tryOnImmediate (timers.js:610:5)
    at processImmediate [as _immediateCallback] (timers.js:582:5)

Focusing this a bit:

parse-git-config/index.js:47:6
remote-origin-url/index.js:24:3
git-repo-name/index.js:15:9
release/lib/repo.js:10:3

If I'm reading this right it appears the problem goes three dependencies deep which is rather sad. Whatever error handling was intended here https://github.com/zeit/release/blob/master/lib/repo.js#L11-L22 is also not working.

I was planning on cooking up a PR but the depth of deps suggests I'll loose a lot of time to get this done. Any advice?

jasonkuhrt avatar Mar 31 '17 17:03 jasonkuhrt

This is particularly a problem with the hugo static site builder. If you follow the example here https://zeit.co/guides/deploying-hugo-with-now/ and deploy it to GitHub it will not work as the subdirectory will not be read.

samrobbins85 avatar Dec 31 '19 13:12 samrobbins85

I have the same problem. I'm going to try git subtree and see if I have more luck.

mathieucaroff avatar Jun 09 '20 16:06 mathieucaroff

git subtree did work where git submodule failed, see the Github subtree cheat-sheet to get started quickly. Using git subtree effectively makes it so vercel has nothing to do other than the usual git clone.

Note: With Hugo, I ran into a problem where I had enableGitInfo set to true in a config file, and this caused the build to fail since the .git repository is not present in the folder during the vercel build step (I believe vercel uses shallow clone). I removed enableGitInfo and it works now.

mathieucaroff avatar Jun 09 '20 19:06 mathieucaroff

Workaround available here: https://thesearemyramblings.com/vercel-submodules-workaround/

motin avatar Aug 25 '20 09:08 motin

I can't remember when the change was made, but git submodules are now working without a workaround for me

samrobbins85 avatar Aug 25 '20 09:08 samrobbins85

I can't remember when the change was made, but git submodules are now working without a workaround for me

That is great news! Maybe with a reference to the appropriate changelog / documentation this issue can now be closed?

EDIT: Vercel indeed seems to try to check out submodules nowadays but it doesn't work for me:

10:25:16 | WARN: failed to fetch one or more git submodules:Failed to clone 'content/blog' a second time, aborting
-- | --

Maybe it just doesn't work with private repo submodules?

motin avatar Aug 25 '20 09:08 motin

hmm yeah gettting failed to clone submoudle error too

archywillhe avatar Dec 24 '20 17:12 archywillhe

It's likely because your .gitmodules specifies SSH syntax, which Vercel does not support. Assuming your repo is public, try changing it to HTTPS: https://github.com/vercel/vercel/discussions/4566#discussioncomment-479622

unitof avatar Mar 14 '21 04:03 unitof