mirror of
https://github.com/Dev-Wiki/git-repo.git
synced 2025-12-14 00:24:05 +08:00
Allow clone depth to be specified per project
If the clone-depth attribute is set on a project, its value will be used to set the depth when fetching the git. The value, if given, must be a positive integer. The value in the clone-depth attribute overrides any value given to repo init via the --depth command line option. Change-Id: I273015b3724213600b63e40cca4cafaa9f782ddf
This commit is contained in:
@@ -488,6 +488,7 @@ class Project(object):
|
||||
groups = None,
|
||||
sync_c = False,
|
||||
sync_s = False,
|
||||
clone_depth = None,
|
||||
upstream = None,
|
||||
parent = None,
|
||||
is_derived = False):
|
||||
@@ -533,6 +534,7 @@ class Project(object):
|
||||
self.groups = groups
|
||||
self.sync_c = sync_c
|
||||
self.sync_s = sync_s
|
||||
self.clone_depth = clone_depth
|
||||
self.upstream = upstream
|
||||
self.parent = parent
|
||||
self.is_derived = is_derived
|
||||
@@ -1645,7 +1647,10 @@ class Project(object):
|
||||
|
||||
# The --depth option only affects the initial fetch; after that we'll do
|
||||
# full fetches of changes.
|
||||
depth = self.manifest.manifestProject.config.GetString('repo.depth')
|
||||
if self.clone_depth:
|
||||
depth = self.clone_depth
|
||||
else:
|
||||
depth = self.manifest.manifestProject.config.GetString('repo.depth')
|
||||
if depth and initial:
|
||||
cmd.append('--depth=%s' % depth)
|
||||
|
||||
@@ -1705,7 +1710,7 @@ class Project(object):
|
||||
return ok
|
||||
|
||||
def _ApplyCloneBundle(self, initial=False, quiet=False):
|
||||
if initial and self.manifest.manifestProject.config.GetString('repo.depth'):
|
||||
if initial and (self.manifest.manifestProject.config.GetString('repo.depth') or self.clone_depth):
|
||||
return False
|
||||
|
||||
remote = self.GetRemote(self.remote.name)
|
||||
|
||||
Reference in New Issue
Block a user