git-fastclone 1.4.2 → 1.4.3

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: da2eb17be407c42dbabdb002d8cee1fb56820f6543df47758b0376e84ed2344e
4
- data.tar.gz: 0c1ca35bca06f608f8087670eba49cb5cc7d6c1af7c308e38159477455bd33c3
3
+ metadata.gz: 4b755aef58d17ded702b989b16fb92cf93908413403bb99f92b542319c59fdbc
4
+ data.tar.gz: c7ad9ab44516bea864027aa562af274bd49999aea62eccbfc3df9421cc6674d6
5
5
  SHA512:
6
- metadata.gz: 4a3d27522c916ac8883ad8abceb5d19529bb406409b3f7904652a54640b2edc91184420baad3118d8379b7c26ce2331018367c994375843c9130ae9511f1108f
7
- data.tar.gz: 413c42026762c4bf1a80d693d2920c0a519969a7d5c4f215fb810b88f6dabb5e449a15d331214c0751e0daa92c4cbc706915e7ca4d9691ec2aaefb292b8cbef6
6
+ metadata.gz: 8f6cff1907474ac42d8a4936dba9e5e684440b72f9995ce80bdb0bc79bc169d79969386b32eb3c8e8cc64358fc1872b0cbb07011d2bebfd753b04423fc1198be
7
+ data.tar.gz: 889d56227ae2aff1aba3d9dfc33fdd7ab554b9f6ae77f21c036c66af5c2eb47756d49e62a2244ca922855442856caaeb772baace5bc1c9f093d1eae0a3043b02
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Version string for git-fastclone
4
4
  module GitFastCloneVersion
5
- VERSION = '1.4.2'
5
+ VERSION = '1.4.3'
6
6
  end
data/lib/git-fastclone.rb CHANGED
@@ -225,10 +225,9 @@ module GitFastClone
225
225
 
226
226
  # Only checkout if we're changing branches to a non-default branch
227
227
  if rev
228
- Dir.chdir(File.join(abs_clone_path, src_dir)) do
229
- fail_on_error('git', 'checkout', '--quiet', rev.to_s, quiet: !verbose,
230
- print_on_failure: print_git_errors)
231
- end
228
+ fail_on_error('git', 'checkout', '--quiet', rev.to_s, quiet: !verbose,
229
+ print_on_failure: print_git_errors,
230
+ chdir: File.join(abs_clone_path, src_dir))
232
231
  end
233
232
 
234
233
  update_submodules(src_dir, url)
@@ -250,11 +249,9 @@ module GitFastClone
250
249
 
251
250
  threads = []
252
251
  submodule_url_list = []
253
- output = ''
254
- Dir.chdir(File.join(abs_clone_path, pwd).to_s) do
255
- output = fail_on_error('git', 'submodule', 'init', quiet: !verbose,
256
- print_on_failure: print_git_errors)
257
- end
252
+ output = fail_on_error('git', 'submodule', 'init', quiet: !verbose,
253
+ print_on_failure: print_git_errors,
254
+ chdir: File.join(abs_clone_path, pwd))
258
255
 
259
256
  output.split("\n").each do |line|
260
257
  submodule_path, submodule_url = parse_update_info(line)
@@ -270,11 +267,10 @@ module GitFastClone
270
267
  def thread_update_submodule(submodule_url, submodule_path, threads, pwd)
271
268
  threads << Thread.new do
272
269
  with_git_mirror(submodule_url) do |mirror, _|
273
- Dir.chdir(File.join(abs_clone_path, pwd).to_s) do
274
- cmd = ['git', 'submodule', verbose ? nil : '--quiet', 'update', '--reference', mirror.to_s,
275
- submodule_path.to_s].compact
276
- fail_on_error(*cmd, quiet: !verbose, print_on_failure: print_git_errors)
277
- end
270
+ cmd = ['git', 'submodule',
271
+ verbose ? nil : '--quiet', 'update', '--reference', mirror.to_s, submodule_path.to_s].compact
272
+ fail_on_error(*cmd, quiet: !verbose, print_on_failure: print_git_errors,
273
+ chdir: File.join(abs_clone_path, pwd))
278
274
  end
279
275
 
280
276
  update_submodules(File.join(pwd, submodule_path), submodule_url)
@@ -350,10 +346,9 @@ module GitFastClone
350
346
  quiet: !verbose, print_on_failure: print_git_errors)
351
347
  end
352
348
 
353
- Dir.chdir(mirror) do
354
- cmd = ['git', 'remote', verbose ? '--verbose' : nil, 'update', '--prune'].compact
355
- fail_on_error(*cmd, quiet: !verbose, print_on_failure: print_git_errors)
356
- end
349
+ cmd = ['git', 'remote', verbose ? '--verbose' : nil, 'update', '--prune'].compact
350
+ fail_on_error(*cmd, quiet: !verbose, print_on_failure: print_git_errors, chdir: mirror)
351
+
357
352
  reference_updated[repo_name] = true
358
353
  rescue RunnerExecutionRuntimeError => e
359
354
  # To avoid corruption of the cache, if we failed to update or check out we remove
@@ -91,7 +91,6 @@ describe GitFastClone::Runner do
91
91
  before(:each) do
92
92
  allow(runner_execution_double).to receive(:fail_on_error) {}
93
93
  allow(Dir).to receive(:pwd) { '/pwd' }
94
- allow(Dir).to receive(:chdir).and_yield
95
94
  allow(subject).to receive(:with_git_mirror).and_yield('/cache', 0)
96
95
  expect(subject).to receive(:clear_clone_dest_if_needed).once {}
97
96
  end
@@ -99,7 +98,7 @@ describe GitFastClone::Runner do
99
98
  it 'should clone correctly' do
100
99
  expect(subject).to receive(:fail_on_error).with(
101
100
  'git', 'checkout', '--quiet', 'PH',
102
- { quiet: true, print_on_failure: false }
101
+ { chdir: '/pwd/.', print_on_failure: false, quiet: true }
103
102
  ) { runner_execution_double }
104
103
  expect(subject).to receive(:fail_on_error).with(
105
104
  'git', 'clone', '--quiet', '--reference', '/cache', 'PH', '/pwd/.',
@@ -113,7 +112,7 @@ describe GitFastClone::Runner do
113
112
  subject.verbose = true
114
113
  expect(subject).to receive(:fail_on_error).with(
115
114
  'git', 'checkout', '--quiet', 'PH',
116
- { quiet: false, print_on_failure: false }
115
+ { chdir: '/pwd/.', print_on_failure: false, quiet: false }
117
116
  ) { runner_execution_double }
118
117
  expect(subject).to receive(:fail_on_error).with(
119
118
  'git', 'clone', '--verbose', '--reference', '/cache', 'PH', '/pwd/.',
@@ -338,7 +337,6 @@ describe GitFastClone::Runner do
338
337
 
339
338
  it 'should correctly update the hash' do
340
339
  allow(subject).to receive(:fail_on_error)
341
- allow(Dir).to receive(:chdir) {}
342
340
 
343
341
  subject.reference_updated = placeholder_hash
344
342
  subject.store_updated_repo(placeholder_arg, placeholder_arg, placeholder_arg, false)
@@ -389,7 +387,6 @@ describe GitFastClone::Runner do
389
387
  expected_command = expected_commands.shift
390
388
  expect(command).to eq(expected_command)
391
389
  }
392
- allow(Dir).to receive(:chdir).and_yield
393
390
 
394
391
  allow(subject).to receive(:print_formatted_error) {}
395
392
  allow(subject).to receive(:reference_repo_dir).and_return(test_reference_repo_dir)
@@ -404,7 +401,8 @@ describe GitFastClone::Runner do
404
401
  [
405
402
  ['git', 'clone', verbose ? '--verbose' : '--quiet', '--mirror', test_url_valid,
406
403
  test_reference_repo_dir],
407
- ['git', 'remote', verbose ? '--verbose' : nil, 'update', '--prune'].compact
404
+ ['git', 'remote', verbose ? '--verbose' : nil, 'update',
405
+ '--prune'].compact
408
406
  ]
409
407
  end
410
408
 
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.2
4
+ version: 1.4.3
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-06-27 00:00:00.000000000 Z
12
+ date: 2023-09-01 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.4.13
69
+ rubygems_version: 3.1.6
70
70
  signing_key:
71
71
  specification_version: 4
72
72
  summary: git-clone --recursive on steroids!