What does repo init and repo sync actually do?

59,228

repo is a python wrapper script for git, its Google Source page defines it as

repo - The Multiple Git Repository Tool

  1. repo init command initializes repo in the current directory. That's, it downloads the latest repo source and a manifest.xml file that describes the directory structure of the git repositories, and store all of these in .repo sub-directory in the current directory. In your case, you have used an optional -b argument which is used to select the branch to checkout. By default (i.e., when -b argument is not used), master branch is used.

  2. repo sync updates working tree to the latest revision. That's, it synchronizes local project directories with the remote repositories specified in the manifest file. If a local project does not yet exist, it will clone a new local directory from the remote repository and set up tracking branches as specified in the manifest. If the local project already exists, it will update the remote branches and rebase any new local changes on top of the new remote changes. -j argument is used to set number of parallel jobs to execute. The default value can be defined in the manifest, and also can be overridden in command line as in your case.

why did it reach 19G when Google said I should only be expecting around 8G of source files?

That should be because besides the source files, you will get all the history of Android since the beginning of the time :)

Hope this helps.

Share:
59,228
Poly Bug
Author by

Poly Bug

Still working on what to do with this project, long overdue!

Updated on December 17, 2020

Comments

  • Poly Bug
    Poly Bug over 3 years

    I posted this question at Android Enthusiasts but figured it was the wrong place to ask, so I deleted it from there and asking it "again" here.


    This is such a noob question, and pardon me if it is, but I just want to understand the underlying concepts clearly. Reading repo help and Google's repo command reference page doesn't really enlighten much. I understood some bits from Google's reference page, but I still need some more clarifications.

    Following the instructions on how to download android source, I executed these two commands on an Ubuntu shell: (I've taken cared of all the prerequisites for the environment.)

    ~/android4.2.2$ repo init -u https://android.googlesource.com/platform/manifest -b android-4.2.2_r1.2
    ~/android4.2.2$ repo sync -j4
    

    After waiting half a day for repo to finish downloading, I ended up with 19G of downloaded material in android4.2.2 directory. So what exactly just happened, and why did it reach 19G when Google said I should only be expecting around 8G of source files?