How to properly cache git submodules?

flashmozzg's Avatar

flashmozzg

04 Aug, 2015 06:33 PM

Maybe I'm missing something but I wanted to cache git submodules my project uses because downloading (and building) them takes a lot. But for some reason I get "Not a git repository: ../.git/modules/submodulename" , after restoring c/project/myproject/submodulename
Am I missing something? Is there a better aproach?

  1. Support Staff 1 Posted by Feodor Fitsner on 04 Aug, 2015 07:02 PM

    Feodor Fitsner's Avatar

    I'm not sure caching entire modules (which are essentially git sub-repos) is a good idea as they include hidden files/folders with attributes applied. I'm not saying that's impossible to implement, but currently cached folder is just zip without being able to store additional meta information.

    Why wouldn't you cache just build results which are stored outside of module folders (to allow them restore)?

  2. 2 Posted by flashmozzg on 04 Aug, 2015 07:42 PM

    flashmozzg's Avatar

    The problem is (and I know that this isn't the best practice) but submodule build results are stored inside their folder in ,for example, /lib subdirectory (which is ignored through .gitignore). But the way caching works right now (e.g. restore is always the first thing to happen) you can't cache this folders without a lot of moving around, because git can't clone in non-empty folder. (So I'd have to move build results into another folder after build success, then restore them to this folder and move them again after submodule update --init).

  3. Support Staff 3 Posted by Feodor Fitsner on 04 Aug, 2015 09:45 PM

    Feodor Fitsner's Avatar

    Then maybe moving folders around it not bad workaround (assuming they should be moved pretty quickly)?

  4. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 01:58 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac