git-fastclone 1.4.3 → 1.4.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4b755aef58d17ded702b989b16fb92cf93908413403bb99f92b542319c59fdbc
4
- data.tar.gz: c7ad9ab44516bea864027aa562af274bd49999aea62eccbfc3df9421cc6674d6
3
+ metadata.gz: c7330529bf940f74fcdf782fa298d7de00d0f75b5ccbd303bb6a99d57668b6a0
4
+ data.tar.gz: 4dc5b12076314094bf03638433dcbc6df5f486b6b2b5da6ff2350c77942b23ca
5
5
  SHA512:
6
- metadata.gz: 8f6cff1907474ac42d8a4936dba9e5e684440b72f9995ce80bdb0bc79bc169d79969386b32eb3c8e8cc64358fc1872b0cbb07011d2bebfd753b04423fc1198be
7
- data.tar.gz: 889d56227ae2aff1aba3d9dfc33fdd7ab554b9f6ae77f21c036c66af5c2eb47756d49e62a2244ca922855442856caaeb772baace5bc1c9f093d1eae0a3043b02
6
+ metadata.gz: c3ce186a25e7acbc07735118a7a9d55bbca2deee8ff7ba79ea8eebdb1dd8ecff2a01beb640528af0ed8d35a9a62bf03161b8afa545ca6ceb5b7b3ea62ce510ba
7
+ data.tar.gz: f6d0ec9167c8dc69ebdd7caad9c24d595bfd83c3400618d8eefaeb1e0ace4f6dc7a1eb4a752bb499f3c2dc16edf522096e4680dd69f414dcbef6dd9bc9addcd3
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][1].
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][2]
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
- [thoughtbot/terrapin][3] - jyurek and collaborators
83
-
84
- [robolson][4]
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
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Version string for git-fastclone
4
4
  module GitFastCloneVersion
5
- VERSION = '1.4.3'
5
+ VERSION = '1.4.4'
6
6
  end
data/lib/git-fastclone.rb CHANGED
@@ -110,7 +110,7 @@ module GitFastClone
110
110
  def run
111
111
  url, path, options = parse_inputs
112
112
 
113
- require_relative './git-fastclone/version'
113
+ require_relative 'git-fastclone/version'
114
114
  msg = "git-fastclone #{GitFastCloneVersion::VERSION}"
115
115
  if color
116
116
  puts msg.yellow
@@ -354,10 +354,17 @@ module GitFastClone
354
354
  # To avoid corruption of the cache, if we failed to update or check out we remove
355
355
  # the cache directory entirely. This may cause the current clone to fail, but if the
356
356
  # underlying error from git is transient it will not affect future clones.
357
- clear_cache(mirror, url)
357
+ #
358
+ # The only exception to this is authentication failures, because they are transient,
359
+ # usually due to either a remote server outage or a local credentials config problem.
360
+ clear_cache(mirror, url) unless auth_error?(e.output)
358
361
  raise e if fail_hard
359
362
  end
360
363
 
364
+ def auth_error?(error)
365
+ error.to_s =~ /.*^fatal: Authentication failed/m
366
+ end
367
+
361
368
  def retriable_error?(error)
362
369
  error_strings = [
363
370
  /^fatal: missing blob object/,
@@ -366,7 +373,8 @@ module GitFastClone
366
373
  /^fatal: pack has \d+ unresolved delta/,
367
374
  /^error: unable to read sha1 file of /,
368
375
  /^fatal: did not receive expected object/,
369
- /^fatal: unable to read tree [a-z0-9]+\n^warning: Clone succeeded, but checkout failed/
376
+ /^fatal: unable to read tree [a-z0-9]+\n^warning: Clone succeeded, but checkout failed/,
377
+ /^fatal: Authentication failed/
370
378
  ]
371
379
  error.to_s =~ /.*#{Regexp.union(error_strings)}/m
372
380
  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.3
4
+ version: 1.4.4
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-09-01 00:00:00.000000000 Z
12
+ date: 2023-11-15 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.1.6
69
+ rubygems_version: 3.4.10
70
70
  signing_key:
71
71
  specification_version: 4
72
72
  summary: git-clone --recursive on steroids!