Skip to content
This repository was archived by the owner on Oct 6, 2024. It is now read-only.
This repository was archived by the owner on Oct 6, 2024. It is now read-only.

Support for submodules (also hosted on github) #28

Closed

Description

@cben

Files within submodules return 404:
https://rawgithub.com/cben/CodeMirror-MathJax/7bfeedfe99d72b44621ba0851e4c5f4e51452565/CodeMirror/lib/codemirror.css
which is unrurprising because raw.github.com also returns 404:
https://raw.github.com/cben/CodeMirror-MathJax/7bfeedfe99d72b44621ba0851e4c5f4e51452565/CodeMirror/lib/codemirror.css
(here CodeMirror/ dir is a submodule)

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.

  1. You could use the API similarly to Symbolic links support. #16 to check if any parent dir is a submodule.
  2. A more efficient solution is just to parse the .gitmodules file e.g.
    https://raw.github.com/cben/CodeMirror-MathJax/7bfeedfe99d72b44621ba0851e4c5f4e51452565/.gitmodules

P.S. Many thanks for creating and running this service 👍 !

Activity

  1. rgrove commented on Mar 20, 2014

    @rgrove
    Owner

    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 .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.

  2. cben commented on Mar 20, 2014

    @cben
    Author

    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.

  3. e404 commented on Jun 4, 2014

    @e404

    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

  4. jonathanong commented on Jul 31, 2014

    @jonathanong

    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.

  5. cben commented on Jun 29, 2015

    @cben
    Author

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions