git-fastclone 1.0.15 → 1.0.16

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
  SHA1:
3
- metadata.gz: 03b562f98b43cc354da19c3d34542285b2530a6c
4
- data.tar.gz: 4dbe3c64b9ef3511ee80efd753331613e4f06550
3
+ metadata.gz: cfb5c1a85a5af61f83695373c9e087a382c7dbf0
4
+ data.tar.gz: b07120a322ee4ca8ac13d0cd98c1251967a70744
5
5
  SHA512:
6
- metadata.gz: 15261fcd42f7041597eaee13a64782c4e5a69a9e7bba85b12f6d43a01e73a66b42f858072f843d48f76304741abf3ffdf59cfd80a37e3341983c7ab95e85f811
7
- data.tar.gz: b1fb6ddc2c6148031d29cfacb7a77a1e32654fd955fd7bc30f88f028abf1fe40d4bc29964e1f2d54489f38a8f763c5b2e67f94ce48324d2397416e77b5481a8b
6
+ metadata.gz: 1b5cfe0a83e6232ae2475d284cfca371d840a0a950bcb4de30bca64f2d94f2a55362d242ac6ec8698c5b6d84304c08d1f1e58d990b892cd930faffabff4c89a5
7
+ data.tar.gz: d5f62ae9d1e60ede4d3e51c991593d4b6874433f8f3c4c55abf17387d1ebdeff19fb9171449e134ba23cef5b5e664a6376fb3f54c5c590d31d1300b6b658c817
data/lib/git-fastclone.rb CHANGED
@@ -270,7 +270,8 @@ module GitFastClone
270
270
  end
271
271
  end
272
272
 
273
- # Stores the fact that our repo has been updated
273
+ # Creates or updates the mirror repo then stores an indication
274
+ # that this repo has been updated on this run of fastclone
274
275
  def store_updated_repo(url, mirror, repo_name, fail_hard)
275
276
  unless Dir.exist?(mirror)
276
277
  Cocaine::CommandLine.new('git clone', '--mirror :url :mirror')
@@ -282,6 +283,10 @@ module GitFastClone
282
283
  reference_updated[repo_name] = true
283
284
 
284
285
  rescue Cocaine::ExitStatusError => e
286
+ # To avoid corruption of the cache, if we failed to update or check out we remove
287
+ # the cache directory entirely. This may cause the current clone to fail, but if the
288
+ # underlying error from git is transient it will not affect future clones.
289
+ FileUtils.remove_entry_secure(mirror, force: true)
285
290
  raise e if fail_hard
286
291
  end
287
292
 
@@ -1,3 +1,3 @@
1
1
  module GitFastCloneVersion
2
- VERSION = '1.0.15'
2
+ VERSION = '1.0.16'
3
3
  end
@@ -203,13 +203,13 @@ describe GitFastClone::Runner do
203
203
  describe '.store_updated_repo' do
204
204
  context 'when fail_hard is true' do
205
205
  it 'should raise a Cocaine error' do
206
- pending('TODO: Fix later')
207
- fail
208
- =begin
206
+ cocaine_commandline_double = double('new_cocaine_commandline')
207
+ allow(cocaine_commandline_double).to receive(:run) { fail Cocaine::ExitStatusError }
208
+ allow(Cocaine::CommandLine).to receive(:new) { cocaine_commandline_double }
209
+ expect(FileUtils).to receive(:remove_entry_secure).with(placeholder_arg, force: true)
209
210
  expect do
210
211
  subject.store_updated_repo(placeholder_arg, placeholder_arg, placeholder_arg, true)
211
212
  end.to raise_error(Cocaine::ExitStatusError)
212
- =end
213
213
  end
214
214
  end
215
215
 
@@ -218,10 +218,11 @@ describe GitFastClone::Runner do
218
218
  cocaine_commandline_double = double('new_cocaine_commandline')
219
219
  allow(cocaine_commandline_double).to receive(:run) { fail Cocaine::ExitStatusError }
220
220
  allow(Cocaine::CommandLine).to receive(:new) { cocaine_commandline_double }
221
+ expect(FileUtils).to receive(:remove_entry_secure).with(placeholder_arg, force: true)
221
222
 
222
223
  expect do
223
224
  subject.store_updated_repo(placeholder_arg, placeholder_arg, placeholder_arg, false)
224
- end.not_to raise_error(Cocaine::ExitStatusError)
225
+ end.not_to raise_error
225
226
  end
226
227
  end
227
228
 
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.0.15
4
+ version: 1.0.16
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: 2016-01-23 00:00:00.000000000 Z
12
+ date: 2016-01-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cocaine