git-fastclone 1.0.15 → 1.0.16
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/lib/git-fastclone.rb +6 -1
- data/lib/git-fastclone/version.rb +1 -1
- data/spec/git_fastclone_runner_spec.rb +6 -5
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: cfb5c1a85a5af61f83695373c9e087a382c7dbf0
         | 
| 4 | 
            +
              data.tar.gz: b07120a322ee4ca8ac13d0cd98c1251967a70744
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 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 | 
            -
                #  | 
| 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 |  | 
| @@ -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 | 
            -
                     | 
| 207 | 
            -
                    fail
         | 
| 208 | 
            -
             | 
| 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 | 
| 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. | 
| 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- | 
| 12 | 
            +
            date: 2016-01-28 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: cocaine
         |