git-fastclone 1.6.0.pre1 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +14 -7
- data/lib/git-fastclone/version.rb +1 -1
- data/lib/git-fastclone.rb +6 -4
- data/spec/git_fastclone_runner_spec.rb +41 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2da379c2c47cd84f92907ba6095ed656563316a58806111ff60676bb68175157
|
|
4
|
+
data.tar.gz: 7bc30f52cbd2f8cf91d40f108fd36c40f82da8c37386d428e7faf59c6431186f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b99f903732f2a3b1607e544f7b778d9503daa40145db48bae0e695f34f7aea6f60ffc09ba3a2bb2e4fea6bcaec92459243d644fac572eab5040ad8349193cd77
|
|
7
|
+
data.tar.gz: f3586247be04241d0c9bb62c5bc76b37420800c13182640e9d8a4529e5e69df0153c8d2c4a7fcedb68e8c3f3be7499f4da4ab6dc3e14dee5b91efd2e2ac9f1ec
|
data/README.md
CHANGED
|
@@ -14,13 +14,13 @@ Why fastclone?
|
|
|
14
14
|
Doing lots of repeated checkouts on a specific machine?
|
|
15
15
|
|
|
16
16
|
| Repository | 1st Fastclone | 2nd Fastclone | git clone | cp -R |
|
|
17
|
-
|
|
|
18
|
-
| angular.js |
|
|
19
|
-
| bootstrap |
|
|
20
|
-
| gradle |
|
|
21
|
-
| linux |
|
|
22
|
-
| react.js |
|
|
23
|
-
| tensorflow |
|
|
17
|
+
| ---------- | ------------- | ------------- | --------- | ----- |
|
|
18
|
+
| angular.js | 8s | 3s | 6s | 0.5s |
|
|
19
|
+
| bootstrap | 26s | 3s | 11s | 0.2s |
|
|
20
|
+
| gradle | 25s | 9s | 19s | 6.2s |
|
|
21
|
+
| linux | 4m 53s | 1m 6s | 3m 51s | 29s |
|
|
22
|
+
| react.js | 18s | 3s | 8s | 0.5s |
|
|
23
|
+
| tensorflow | 19s | 4s | 8s | 1.5s |
|
|
24
24
|
|
|
25
25
|
Above times captured using `time` without verbose mode.
|
|
26
26
|
|
|
@@ -51,6 +51,8 @@ Usage
|
|
|
51
51
|
--lock-timeout N Timeout in seconds to acquire a lock on any reference repo.
|
|
52
52
|
Default is 0 which waits indefinitely.
|
|
53
53
|
--pre-clone-hook command An optional command that should be invoked before cloning mirror repo
|
|
54
|
+
--sparse-paths PATHS Comma-separated list of paths for sparse checkout.
|
|
55
|
+
Enables sparse checkout mode using git sparse-checkout.
|
|
54
56
|
|
|
55
57
|
Change the default `REFERENCE_REPO_DIR` environment variable if necessary.
|
|
56
58
|
|
|
@@ -66,6 +68,11 @@ The hook is invoked with given arguments:
|
|
|
66
68
|
1. path to the repo mirror location
|
|
67
69
|
1. attempt number, 0-indexed
|
|
68
70
|
|
|
71
|
+
Sparse checkout support
|
|
72
|
+
-----------------------
|
|
73
|
+
|
|
74
|
+
In passing `--sparse-paths`, git-fastclone will instead perform a sparse checkout, where the passed list of paths will be set up as patterns. This can be useful if you're interested only in a subset of paths in the repository.
|
|
75
|
+
|
|
69
76
|
How to test?
|
|
70
77
|
------------
|
|
71
78
|
Manual testing:
|
data/lib/git-fastclone.rb
CHANGED
|
@@ -252,10 +252,12 @@ module GitFastClone
|
|
|
252
252
|
clear_clone_dest_if_needed(attempt_number, clone_dest)
|
|
253
253
|
|
|
254
254
|
clone_commands = ['git', 'clone', verbose ? '--verbose' : '--quiet']
|
|
255
|
-
|
|
256
|
-
#
|
|
255
|
+
# For sparse checkouts, clone directly from the local mirror and skip the actual checkout process
|
|
256
|
+
# --shared is included so that the checkout remains fast even if the reference and destination directories
|
|
257
|
+
# live on different filesystem volumes.
|
|
257
258
|
# For normal clones, use --reference and clone from the remote URL
|
|
258
259
|
if sparse_paths
|
|
260
|
+
clone_commands.push('--no-checkout', '--shared')
|
|
259
261
|
clone_commands << mirror.to_s << clone_dest
|
|
260
262
|
else
|
|
261
263
|
clone_commands << '--reference' << mirror.to_s << url.to_s << clone_dest
|
|
@@ -264,7 +266,7 @@ module GitFastClone
|
|
|
264
266
|
fail_on_error(*clone_commands, quiet: !verbose, print_on_failure: print_git_errors)
|
|
265
267
|
|
|
266
268
|
# Configure sparse checkout if enabled
|
|
267
|
-
|
|
269
|
+
perform_sparse_checkout(clone_dest, rev) if sparse_paths
|
|
268
270
|
end
|
|
269
271
|
|
|
270
272
|
# Only checkout if we're changing branches to a non-default branch (for non-sparse clones)
|
|
@@ -286,7 +288,7 @@ module GitFastClone
|
|
|
286
288
|
end
|
|
287
289
|
end
|
|
288
290
|
|
|
289
|
-
def
|
|
291
|
+
def perform_sparse_checkout(clone_dest, rev)
|
|
290
292
|
puts 'Configuring sparse checkout...' if verbose
|
|
291
293
|
|
|
292
294
|
# Initialize sparse checkout with cone mode
|
|
@@ -145,6 +145,47 @@ describe GitFastClone::Runner do
|
|
|
145
145
|
end
|
|
146
146
|
end
|
|
147
147
|
|
|
148
|
+
context 'with sparse checkout' do
|
|
149
|
+
before(:each) do
|
|
150
|
+
subject.sparse_paths = %w[path1 path2]
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
it 'should clone with --no-checkout and --shared flags' do
|
|
154
|
+
expect(subject).to receive(:fail_on_error).with(
|
|
155
|
+
'git', 'clone', '--quiet', '--no-checkout', '--shared', '/cache', '/pwd/.',
|
|
156
|
+
{ quiet: true, print_on_failure: false }
|
|
157
|
+
) { runner_execution_double }
|
|
158
|
+
expect(subject).to receive(:perform_sparse_checkout).with('/pwd/.', 'PH')
|
|
159
|
+
|
|
160
|
+
subject.clone(placeholder_arg, 'PH', '.', nil)
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
it 'should clone with verbose mode and --shared flag' do
|
|
164
|
+
subject.verbose = true
|
|
165
|
+
expect(subject).to receive(:fail_on_error).with(
|
|
166
|
+
'git', 'clone', '--verbose', '--no-checkout', '--shared', '/cache', '/pwd/.',
|
|
167
|
+
{ quiet: false, print_on_failure: false }
|
|
168
|
+
) { runner_execution_double }
|
|
169
|
+
expect(subject).to receive(:perform_sparse_checkout).with('/pwd/.', 'PH')
|
|
170
|
+
|
|
171
|
+
subject.clone(placeholder_arg, 'PH', '.', nil)
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
it 'should not perform regular checkout when sparse checkout is enabled' do
|
|
175
|
+
expect(subject).to receive(:fail_on_error).with(
|
|
176
|
+
'git', 'clone', '--quiet', '--no-checkout', '--shared', '/cache', '/pwd/.',
|
|
177
|
+
{ quiet: true, print_on_failure: false }
|
|
178
|
+
) { runner_execution_double }
|
|
179
|
+
expect(subject).to receive(:perform_sparse_checkout).with('/pwd/.', 'PH')
|
|
180
|
+
expect(subject).not_to receive(:fail_on_error).with(
|
|
181
|
+
'git', 'checkout', '--quiet', 'PH',
|
|
182
|
+
anything
|
|
183
|
+
)
|
|
184
|
+
|
|
185
|
+
subject.clone(placeholder_arg, 'PH', '.', nil)
|
|
186
|
+
end
|
|
187
|
+
end
|
|
188
|
+
|
|
148
189
|
context 'with pre-clone-hook' do
|
|
149
190
|
let(:pre_clone_hook) { '/some/command' }
|
|
150
191
|
before(:each) do
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: git-fastclone
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.6.
|
|
4
|
+
version: 1.6.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Michael Tauraso
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2025-11-
|
|
12
|
+
date: 2025-11-27 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: colorize
|