Search code examples
gitandroid-sourcerepository

Save space when downloading Android source


I'm looking for a way to work with the Android source, and at the same time trying to keep the disk space usage low. Is it possible to init some projects as shallow (the ones I only need the latest source and won't be modifying) and others as regular git repos to be able to fetch, push, etc?

EDIT: repo has a --depth=DEPTH parameter, I was wondering if that parameter could be different for each subproject.


Solution

  • The only realistically practical way to clone and maintain full Android tree is using repo utility with repo init and repo sync. As far as I know, repo does not support shallow repositories. But checking out 200-400 of git repositories without using repo is extremely difficult.

    Also, keep in mind that it is quite common that git metadata which is stored packed in .git directories takes less space than just checkout of top commit (however repo plays some tricks with symlinks, so actual data is stored under .repo). So, in absolutely best case you are going to save no more than 50% of disk space, but realistically it is going to be much less of a difference.

    Finally, with today's typical HDD sizes of 1TB or more, the only possible reason to keep disk usage low is when you are working on SSD. Full Android tree should comfortably fit into about 30GB (even with build out/ directory), which makes rather small 128 GB SSD quite practical solution for Android development.