git-fastclone 1.4.3 → 1.4.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -19
- data/lib/git-fastclone/version.rb +1 -1
- data/lib/git-fastclone.rb +23 -5
- data/spec/git_fastclone_runner_spec.rb +13 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f23af05975dc472665784e91a3e69112694837cbd2a873076a7fb3197828970f
|
4
|
+
data.tar.gz: b3e2a26cbf1aff738c647eb37aa6b661975a396b680352288f68c0ba20da429d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9f239ae1a6cdf02d8aef5944f4d704bffaeb0d410191d7f5b7c759ba1d525dca27dd8efcec2e19ac4ffee9787ff3706b16860d0e16ff493136bcb2378b70a7c
|
7
|
+
data.tar.gz: fb954090b896bf41a396c956847133fc7d367fc564fbc8e3973ed61f2738b16f3926397b4526994d6c6d1781439970055f67e5c7d8137a0174a4f614b69f7a60
|
data/README.md
CHANGED
@@ -35,7 +35,7 @@ It aggressively updates these mirrors from origin and then clones from the mirro
|
|
35
35
|
directory of your choosing. It always works recursively and multithreaded to get your checkout up as
|
36
36
|
fast as possible.
|
37
37
|
|
38
|
-
Detailed explanation [here]
|
38
|
+
Detailed explanation [here](https://developer.squareup.com/blog/introducing-git-fastclone/).
|
39
39
|
|
40
40
|
|
41
41
|
Usage
|
@@ -71,7 +71,7 @@ requests.
|
|
71
71
|
When submitting code, please make every effort to follow existing conventions and style in order to
|
72
72
|
keep the code as readable as possible.
|
73
73
|
|
74
|
-
Before accepting any pull requests, we need you to sign an [Individual Contributor Agreement]
|
74
|
+
Before accepting any pull requests, we need you to sign an [Individual Contributor Agreement](https://docs.google.com/a/squareup.com/forms/d/13WR8m5uZ2nAkJH41k7GdVBXAAbzDk00vxtEYjd6Imzg/viewform?formkey=dDViT2xzUHAwRkI3X3k5Z0lQM091OGc6MQ&ndplr=1)
|
75
75
|
(Google form).
|
76
76
|
|
77
77
|
Once landed, please reach out to any owner listed in https://rubygems.org/gems/git-fastclone and ask them to help publish the new version.
|
@@ -79,15 +79,10 @@ Once landed, please reach out to any owner listed in https://rubygems.org/gems/g
|
|
79
79
|
|
80
80
|
Acknowledgements
|
81
81
|
----------------
|
82
|
-
[
|
83
|
-
|
84
|
-
[
|
85
|
-
|
86
|
-
[ianchesal][5]
|
87
|
-
|
88
|
-
[mtauraso][6]
|
89
|
-
|
90
|
-
[chriseckhardt][7]
|
82
|
+
* [robolson](https://github.com/robolson)
|
83
|
+
* [ianchesal](https://github.com/ianchesal)
|
84
|
+
* [mtauraso](https://github.com/mtauraso)
|
85
|
+
* [chriseckhardt](https://github.com/chriseckhardt)
|
91
86
|
|
92
87
|
|
93
88
|
License
|
@@ -105,11 +100,3 @@ License
|
|
105
100
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
106
101
|
See the License for the specific language governing permissions and
|
107
102
|
limitations under the License.
|
108
|
-
|
109
|
-
[1]: https://corner.squareup.com/2015/11/fastclone.html
|
110
|
-
[2]: https://docs.google.com/a/squareup.com/forms/d/13WR8m5uZ2nAkJH41k7GdVBXAAbzDk00vxtEYjd6Imzg/viewform?formkey=dDViT2xzUHAwRkI3X3k5Z0lQM091OGc6MQ&ndplr=1
|
111
|
-
[3]: https://github.com/thoughtbot/terrapin
|
112
|
-
[4]: https://github.com/robolson
|
113
|
-
[5]: https://github.com/ianchesal
|
114
|
-
[6]: https://github.com/mtauraso
|
115
|
-
[7]: https://github.com/chriseckhardt
|
data/lib/git-fastclone.rb
CHANGED
@@ -47,13 +47,23 @@ module GitFastClone
|
|
47
47
|
end
|
48
48
|
module_function :reference_repo_dir
|
49
49
|
|
50
|
+
def reference_filename(filename)
|
51
|
+
separator = if RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw|cygwin|bccwin|wince|emc/
|
52
|
+
'__'
|
53
|
+
else
|
54
|
+
':'
|
55
|
+
end
|
56
|
+
"#{separator}#{filename}"
|
57
|
+
end
|
58
|
+
module_function :reference_filename
|
59
|
+
|
50
60
|
def reference_repo_submodule_file(url, reference_dir, using_local_repo)
|
51
|
-
"#{reference_repo_dir(url, reference_dir, using_local_repo)}
|
61
|
+
"#{reference_repo_dir(url, reference_dir, using_local_repo)}#{reference_filename('submodules.txt')}"
|
52
62
|
end
|
53
63
|
module_function :reference_repo_submodule_file
|
54
64
|
|
55
65
|
def reference_repo_lock_file(url, reference_dir, using_local_repo)
|
56
|
-
lock_file_name = "#{reference_repo_dir(url, reference_dir, using_local_repo)}
|
66
|
+
lock_file_name = "#{reference_repo_dir(url, reference_dir, using_local_repo)}#{reference_filename('lock')}"
|
57
67
|
File.open(lock_file_name, File::RDWR | File::CREAT, 0o644)
|
58
68
|
end
|
59
69
|
module_function :reference_repo_lock_file
|
@@ -110,7 +120,7 @@ module GitFastClone
|
|
110
120
|
def run
|
111
121
|
url, path, options = parse_inputs
|
112
122
|
|
113
|
-
require_relative '
|
123
|
+
require_relative 'git-fastclone/version'
|
114
124
|
msg = "git-fastclone #{GitFastCloneVersion::VERSION}"
|
115
125
|
if color
|
116
126
|
puts msg.yellow
|
@@ -354,10 +364,17 @@ module GitFastClone
|
|
354
364
|
# To avoid corruption of the cache, if we failed to update or check out we remove
|
355
365
|
# the cache directory entirely. This may cause the current clone to fail, but if the
|
356
366
|
# underlying error from git is transient it will not affect future clones.
|
357
|
-
|
367
|
+
#
|
368
|
+
# The only exception to this is authentication failures, because they are transient,
|
369
|
+
# usually due to either a remote server outage or a local credentials config problem.
|
370
|
+
clear_cache(mirror, url) unless auth_error?(e.output)
|
358
371
|
raise e if fail_hard
|
359
372
|
end
|
360
373
|
|
374
|
+
def auth_error?(error)
|
375
|
+
error.to_s =~ /.*^fatal: Authentication failed/m
|
376
|
+
end
|
377
|
+
|
361
378
|
def retriable_error?(error)
|
362
379
|
error_strings = [
|
363
380
|
/^fatal: missing blob object/,
|
@@ -366,7 +383,8 @@ module GitFastClone
|
|
366
383
|
/^fatal: pack has \d+ unresolved delta/,
|
367
384
|
/^error: unable to read sha1 file of /,
|
368
385
|
/^fatal: did not receive expected object/,
|
369
|
-
/^fatal: unable to read tree [a-z0-9]+\n^warning: Clone succeeded, but checkout failed
|
386
|
+
/^fatal: unable to read tree [a-z0-9]+\n^warning: Clone succeeded, but checkout failed/,
|
387
|
+
/^fatal: Authentication failed/
|
370
388
|
]
|
371
389
|
error.to_s =~ /.*#{Regexp.union(error_strings)}/m
|
372
390
|
end
|
@@ -308,7 +308,7 @@ describe GitFastClone::Runner do
|
|
308
308
|
|
309
309
|
describe '.store_updated_repo' do
|
310
310
|
context 'when fail_hard is true' do
|
311
|
-
it 'should raise a Runtime error and clear cache' do
|
311
|
+
it 'should raise a Runtime error and clear cache if there were no authentication errors' do
|
312
312
|
status = double('status')
|
313
313
|
allow(status).to receive(:exitstatus).and_return(1)
|
314
314
|
ex = RunnerExecution::RunnerExecutionRuntimeError.new(status, 'cmd')
|
@@ -318,6 +318,18 @@ describe GitFastClone::Runner do
|
|
318
318
|
subject.store_updated_repo(placeholder_arg, placeholder_arg, placeholder_arg, true)
|
319
319
|
end.to raise_error(ex)
|
320
320
|
end
|
321
|
+
|
322
|
+
it 'should raise a Runtime error and skip clearing the cache if there were authentication errors' do
|
323
|
+
status = double('status')
|
324
|
+
allow(status).to receive(:exitstatus).and_return(1)
|
325
|
+
ex = RunnerExecution::RunnerExecutionRuntimeError.new(status, 'cmd')
|
326
|
+
allow(ex).to receive(:output).and_return('fatal: Authentication failed')
|
327
|
+
allow(subject).to receive(:fail_on_error) { raise ex }
|
328
|
+
expect(FileUtils).to_not receive(:remove_entry_secure).with(placeholder_arg, force: true)
|
329
|
+
expect do
|
330
|
+
subject.store_updated_repo(placeholder_arg, placeholder_arg, placeholder_arg, true)
|
331
|
+
end.to raise_error(ex)
|
332
|
+
end
|
321
333
|
end
|
322
334
|
|
323
335
|
context 'when fail_hard is false' 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.4.
|
4
|
+
version: 1.4.5
|
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: 2023-
|
12
|
+
date: 2023-12-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: colorize
|
@@ -66,7 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
66
66
|
- !ruby/object:Gem::Version
|
67
67
|
version: '0'
|
68
68
|
requirements: []
|
69
|
-
rubygems_version: 3.
|
69
|
+
rubygems_version: 3.4.10
|
70
70
|
signing_key:
|
71
71
|
specification_version: 4
|
72
72
|
summary: git-clone --recursive on steroids!
|