summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xproject.py10
-rwxr-xr-xrepo3
-rw-r--r--subcmds/init.py11
3 files changed, 24 insertions, 0 deletions
diff --git a/project.py b/project.py
index d551351b..a7001b01 100755
--- a/project.py
+++ b/project.py
@@ -1310,6 +1310,16 @@ class Project(object):
1310 submodules=submodules)): 1310 submodules=submodules)):
1311 return False 1311 return False
1312 1312
1313 mp = self.manifest.manifestProject
1314 dissociate = mp.config.GetBoolean('repo.dissociate')
1315 if dissociate:
1316 alternates_file = os.path.join(self.gitdir, 'objects/info/alternates')
1317 if os.path.exists(alternates_file):
1318 cmd = ['repack', '-a', '-d']
1319 if GitCommand(self, cmd, bare=True).Wait() != 0:
1320 return False
1321 platform_utils.remove(alternates_file)
1322
1313 if self.worktree: 1323 if self.worktree:
1314 self._InitMRef() 1324 self._InitMRef()
1315 else: 1325 else:
diff --git a/repo b/repo
index 6d3e8c2f..998731c6 100755
--- a/repo
+++ b/repo
@@ -190,6 +190,9 @@ group.add_option('--mirror',
190group.add_option('--reference', 190group.add_option('--reference',
191 dest='reference', 191 dest='reference',
192 help='location of mirror directory', metavar='DIR') 192 help='location of mirror directory', metavar='DIR')
193group.add_option('--dissociate',
194 dest='dissociate', action='store_true',
195 help='dissociate from reference mirrors after clone')
193group.add_option('--depth', type='int', default=None, 196group.add_option('--depth', type='int', default=None,
194 dest='depth', 197 dest='depth',
195 help='create a shallow clone with given depth; see git clone') 198 help='create a shallow clone with given depth; see git clone')
diff --git a/subcmds/init.py b/subcmds/init.py
index 4e51dfe8..6e99658f 100644
--- a/subcmds/init.py
+++ b/subcmds/init.py
@@ -61,6 +61,11 @@ directory use as much data as possible from the local reference
61directory when fetching from the server. This will make the sync 61directory when fetching from the server. This will make the sync
62go a lot faster by reducing data traffic on the network. 62go a lot faster by reducing data traffic on the network.
63 63
64The --dissociate option can be used to borrow the objects from
65the directory specified with the --reference option only to reduce
66network transfer, and stop borrowing from them after a first clone
67is made by making necessary local copies of borrowed objects.
68
64The --no-clone-bundle option disables any attempt to use 69The --no-clone-bundle option disables any attempt to use
65$URL/clone.bundle to bootstrap a new Git repository from a 70$URL/clone.bundle to bootstrap a new Git repository from a
66resumeable bundle file on a content delivery network. This 71resumeable bundle file on a content delivery network. This
@@ -103,6 +108,9 @@ to update the working directory files.
103 g.add_option('--reference', 108 g.add_option('--reference',
104 dest='reference', 109 dest='reference',
105 help='location of mirror directory', metavar='DIR') 110 help='location of mirror directory', metavar='DIR')
111 g.add_option('--dissociate',
112 dest='dissociate', action='store_true',
113 help='dissociate from reference mirrors after clone')
106 g.add_option('--depth', type='int', default=None, 114 g.add_option('--depth', type='int', default=None,
107 dest='depth', 115 dest='depth',
108 help='create a shallow clone with given depth; see git clone') 116 help='create a shallow clone with given depth; see git clone')
@@ -219,6 +227,9 @@ to update the working directory files.
219 if opt.reference: 227 if opt.reference:
220 m.config.SetString('repo.reference', opt.reference) 228 m.config.SetString('repo.reference', opt.reference)
221 229
230 if opt.dissociate:
231 m.config.SetString('repo.dissociate', 'true')
232
222 if opt.archive: 233 if opt.archive:
223 if is_new: 234 if is_new:
224 m.config.SetString('repo.archive', 'true') 235 m.config.SetString('repo.archive', 'true')