You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 6, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on Oct 6, 2024. It is now read-only.
Support for submodules (also hosted on github) #28
But they do work on Github Pages (only one level deep), and rawgithub is handy even for Pages-hosted projects to send sombody a demo from a specific version/branch, so it'd be nice if it followed submodules.
I didn't get around to mentioning this on #16, but it turns out that hitting the GitHub API on every uncached request would cause us to run afoul of rate limits within minutes, so that's probably out of the question.
The alternative -- looking for .gitmodules on every uncached request (or maybe just when a request 404s) -- is a little more feasible, but would require some work. I'm not sure there are a lot of people who'd want this (you're the first to ask for it!), but if it turns out I'm wrong and lots of people would love it, I'm willing to give it some thought.
I think you only need to do this on every request that got 404.
Better yet if a page loads multiple files from a submodule, once you have
.gitmodules in cache you can avoid the 404 requests and directly go to the
submodule.
Turns out .gitmodules is not enough — it contains url and usually branch info but not the precise sha needed to follow the submodule. So an API call is still necessary — but only when we're dealing with an actual submodule, and only once.
It seems even possible to do one call per cointaining directory (in many projects all submodules are at root level) — v3 lists submodules in a directory with "type": "file" for backward compatibility, but we'll already know those are submodules from .gitmodules and their "sha"s are correct.
Activity
rgrove commentedon Mar 20, 2014
Good suggestion.
I didn't get around to mentioning this on #16, but it turns out that hitting the GitHub API on every uncached request would cause us to run afoul of rate limits within minutes, so that's probably out of the question.
The alternative -- looking for
.gitmoduleson every uncached request (or maybe just when a request 404s) -- is a little more feasible, but would require some work. I'm not sure there are a lot of people who'd want this (you're the first to ask for it!), but if it turns out I'm wrong and lots of people would love it, I'm willing to give it some thought.cben commentedon Mar 20, 2014
I think you only need to do this on every request that got 404.
Better yet if a page loads multiple files from a submodule, once you have
.gitmodules in cache you can avoid the 404 requests and directly go to the
submodule.
e404 commentedon Jun 4, 2014
Me = Also want to get submodules resolved. Please @rgrove.
This is essential as many repositories contain submodules.
Just by now, I had to do this (and this is very ugly):
https://github.com/e404/Genesis/commit/516924ce50338ccb77563acaa5414be78d252399
cben commentedon Jun 22, 2014
Minor update: Github Pages now supports deferences multiple levels of submodules
(example with 2:
https://cben.github.io/mathdown/.gitmodules ->
https://cben.github.io/mathdown/CodeMirror-MathJax/.gitmodules ->
https://cben.github.io/mathdown/CodeMirror-MathJax/CodeMirror/index.html)
jonathanong commentedon Jul 31, 2014
so i just wrote https://github.com/repo-utils/glitter. maybe you could just clone the entire repo and not bother doing github API requests.
cben commentedon Jun 29, 2015
Turns out
.gitmodulesis not enough — it contains url and usually branch info but not the precise sha needed to follow the submodule. So an API call is still necessary — but only when we're dealing with an actual submodule, and only once.It seems even possible to do one call per cointaining directory (in many projects all submodules are at root level) — v3 lists submodules in a directory with
"type": "file"for backward compatibility, but we'll already know those are submodules from.gitmodulesand their "sha"s are correct.