summaryrefslogtreecommitdiffstats
path: root/subcmds
diff options
context:
space:
mode:
authorNikolai Merinov <n.merinov@inango-systems.com>2018-10-19 15:07:05 +0500
committerNikolai Merinov <n.merinov@inango-systems.com>2018-10-19 23:51:23 +0500
commit09f0abb0efde83cfc4b850ebdc41f6ed3b61a123 (patch)
tree18265441fc938e567fbf7fae409de11bc2e6bfd7 /subcmds
parentb3133a31642ea88f0e4fe9c382411d43278dc9e4 (diff)
downloadgit-repo-09f0abb0efde83cfc4b850ebdc41f6ed3b61a123.tar.gz
init: --dissociate option to copy objects borrowed with --reference
"repo init --reference" has two purposes: to decrease bandwidth used at clone time, and to decrease disk usage afterward, by using the reference repositories as an alternate store of objects even after the clone. The downside is that it makes the borrowing repositories dependent on the reference repositories, so it is easy to end up with missing objects by mistake after a cleanup operation like "git gc". To prevent that, v2.3.0-rc0~30^2 (clone: --dissociate option to mark that reference is only temporary, 2014-10-14), "git clone" gained a --dissociate option that makes --reference reuse objects from the reference repository at clone time but copy them over instead of using the reference as an alternate. This is more straightforward to use than plain --reference, at the cost of higher disk usage. Introduce a --dissociate to "repo init" that brings the same benefits to repo. The option is simply passed on to "git clone". Change-Id: Ib50a549eb71e0a2b3e234aea57537923962a80d4
Diffstat (limited to 'subcmds')
-rw-r--r--subcmds/init.py11
1 files changed, 11 insertions, 0 deletions
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')