Skip to content

Commit

Permalink
init: change --depth default to 1 for manifest repo
Browse files Browse the repository at this point in the history
People rarely care about the history of the manifest repo.  Change
the default to 1 to speed up initial setup.  If people really want
the full history, they can pass --manifest-depth=0.

We can't reuse the existing --depth option because that applies to
all projects we clone, not just the manifest repo.

Bug: https://crbug.com/gerrit/16193
Change-Id: Ideab1712e9ffc743b9bae97903e074d7d429b134
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/343435
Tested-by: Mike Frysinger <[email protected]>
Reviewed-by: LaMont Jones <[email protected]>
  • Loading branch information
vapier committed Aug 18, 2022
1 parent 790f4ce commit 076d546
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions man/repo-gitc-init.1
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ sync any submodules associated with the manifest repo
\fB\-\-standalone\-manifest\fR
download the manifest as a static file rather then
create a git checkout of the manifest repo
.TP
\fB\-\-manifest\-depth\fR=\fI\,DEPTH\/\fR
create a shallow clone of the manifest repo with given
depth; see git clone (default: 1)
.SS Manifest (only) checkout options:
.TP
\fB\-\-current\-branch\fR
Expand Down
4 changes: 4 additions & 0 deletions man/repo-init.1
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ sync any submodules associated with the manifest repo
\fB\-\-standalone\-manifest\fR
download the manifest as a static file rather then
create a git checkout of the manifest repo
.TP
\fB\-\-manifest\-depth\fR=\fI\,DEPTH\/\fR
create a shallow clone of the manifest repo with given
depth; see git clone (default: 1)
.SS Manifest (only) checkout options:
.TP
\fB\-c\fR, \fB\-\-current\-branch\fR
Expand Down
3 changes: 3 additions & 0 deletions repo
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,9 @@ def InitParser(parser, gitc_init=False):
help='download the manifest as a static file '
'rather then create a git checkout of '
'the manifest repo')
group.add_option('--manifest-depth', type='int', default=1, metavar='DEPTH',
help='create a shallow clone of the manifest repo with '
'given depth; see git clone (default: %default)')

# Options that only affect manifest project, and not any of the projects
# specified in the manifest itself.
Expand Down
4 changes: 4 additions & 0 deletions subcmds/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ def _SyncManifest(self, opt):
Args:
opt: options from optparse.
"""
# Normally this value is set when instantiating the project, but the
# manifest project is special and is created when instantiating the
# manifest which happens before we parse options.
self.manifest.manifestProject.clone_depth = opt.manifest_depth
if not self.manifest.manifestProject.Sync(
manifest_url=opt.manifest_url,
manifest_branch=opt.manifest_branch,
Expand Down

0 comments on commit 076d546

Please sign in to comment.