Search code examples
androidandroid-sourcerepo

repo sync aosp of android-4.3_r1, the size of the .repo directory reach 70G


I have download the Android source code with the commands like:

repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-4.3_r1 --repo-url=git://codeaurora.org/tools/repo.git --repo-branch=caf-stable
repo sync

The size of android-4.3_r1 source code is about 7G. But the size of .repo directory is reach to 70G. size of AOSP

Enter .repo directory and found there is a project-objects directory sizeof 70G. size of .repo

Why is the repo directory so huge? What dose the project-objects directory use for?


Solution

  • It's OK.

    .repo/project-objects contains Git Objects

    When you use repo, Git objects are not stored directly in the repository. If you take a look at the .git directory of one of the repository of your workspace you will see a lot of symbolic link to .repo/project-objects.

    For example:

    $ cd bionic/.git
    $ la
    -rw-rw-r-- 1 hugo hugo   41 juin  22 15:24 [2]  HEAD
    lrwxrwxrwx 1 hugo hugo   38 juin  22 15:24 [3]  config -> ../../.repo/projects/bionic.git/config
    lrwxrwxrwx 1 hugo hugo   55 juin  22 15:24 [4]  description -> ../../.repo/project-objects/aosp/bionic.git/description
    lrwxrwxrwx 1 hugo hugo   49 juin  22 15:24 [5]  hooks -> ../../.repo/project-objects/aosp/bionic.git/hooks
    -rw-rw-r-- 1 hugo hugo 440K juil.  3 15:42 [6]  index
    lrwxrwxrwx 1 hugo hugo   48 juin  22 15:24 [7]  info -> ../../.repo/project-objects/aosp/bionic.git/info
    lrwxrwxrwx 1 hugo hugo   36 juin  22 15:24 [8]  logs -> ../../.repo/projects/bionic.git/logs
    lrwxrwxrwx 1 hugo hugo   51 juin  22 15:24 [9]  objects -> ../../.repo/project-objects/aosp/bionic.git/objects
    lrwxrwxrwx 1 hugo hugo   43 juin  22 15:24 [10] packed-refs -> ../../.repo/projects/bionic.git/packed-refs
    lrwxrwxrwx 1 hugo hugo   36 juin  22 15:24 [11] refs -> ../../.repo/projects/bionic.git/refs
    lrwxrwxrwx 1 hugo hugo   52 juin  22 15:24 [12] rr-cache -> ../../.repo/project-objects/aosp/bionic.git/rr-cache
    lrwxrwxrwx 1 hugo hugo   39 juin  22 15:24 [13] shallow -> ../../.repo/projects/bionic.git/shallow
    lrwxrwxrwx 1 hugo hugo   47 juin  22 15:24 [14] svn -> ../../.repo/project-objects/aosp/bionic.git/svn
    

    Another interesting things to note is the two step in repo sync:

    • the first one is the fetch, during which Git object will be downloaded from the server to the .repo/project-objects

    • the second one is the checkout phase where the files are copied from the .repo/project-objects to the working directory

    It means that if you delete all the directories except the .repo and sync again the fetch phase will be pretty fast (depending on new modifications on the remote) and that repo sync will mostly do copy to the working directory during the checkout phase.