Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby-version: ["2.7.4", "3.0.6", "3.1.4", "3.2.2", "3.3.0-preview3"]
ruby-version: ["3.2.2", "3.3.9", "3.4.0", "3.5.0-preview1"]
experimental: [false]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: Set up Ruby
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
# change this to (see https://github.com/ruby/setup-ruby#versioning):
Expand Down
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
inherit_from: .rubocop_todo.yml

AllCops:
TargetRubyVersion: 2.7
TargetRubyVersion: 3.2
NewCops: enable

Naming/FileName:
Expand Down
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.3.9
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ source 'https://rubygems.org'
group :development do
gem 'bundler'
gem 'rake'
gem 'rubocop', install_if: -> { RUBY_VERSION >= '2.3' }
gem 'rubocop', install_if: -> { RUBY_VERSION >= '3.2' }
end

gem 'logger'
gem 'rspec'

gemspec
71 changes: 39 additions & 32 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,61 +7,68 @@ PATH
GEM
remote: https://rubygems.org/
specs:
ast (2.4.2)
ast (2.4.3)
colorize (1.1.0)
diff-lcs (1.5.0)
json (2.6.3)
language_server-protocol (3.17.0.3)
parallel (1.23.0)
parser (3.2.2.4)
diff-lcs (1.6.2)
json (2.15.0)
language_server-protocol (3.17.0.5)
lint_roller (1.1.0)
logger (1.7.0)
parallel (1.27.0)
parser (3.3.9.0)
ast (~> 2.4.1)
racc
racc (1.7.3)
prism (1.5.1)
racc (1.8.1)
rainbow (3.1.1)
rake (13.1.0)
regexp_parser (2.8.2)
rexml (3.2.6)
rspec (3.12.0)
rspec-core (~> 3.12.0)
rspec-expectations (~> 3.12.0)
rspec-mocks (~> 3.12.0)
rspec-core (3.12.2)
rspec-support (~> 3.12.0)
rspec-expectations (3.12.3)
rake (13.3.0)
regexp_parser (2.11.3)
rspec (3.13.1)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.5)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.5)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.6)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.5)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-support (3.12.1)
rubocop (1.57.2)
rspec-support (~> 3.13.0)
rspec-support (3.13.6)
rubocop (1.81.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
parallel (~> 1.10)
parser (>= 3.2.2.4)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.28.1, < 2.0)
regexp_parser (>= 2.9.3, < 3.0)
rubocop-ast (>= 1.47.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.30.0)
parser (>= 3.2.1.0)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.47.1)
parser (>= 3.3.7.2)
prism (~> 1.4)
ruby-progressbar (1.13.0)
unicode-display_width (2.5.0)
unicode-display_width (3.2.0)
unicode-emoji (~> 4.1)
unicode-emoji (4.1.0)

PLATFORMS
arm64-darwin-22
arm64-darwin-23
arm64-darwin-24
x64-mingw-ucrt
x86_64-linux

DEPENDENCIES
bundler
git-fastclone!
logger
rake
rspec
rubocop

BUNDLED WITH
2.4.22
2.5.22
4 changes: 2 additions & 2 deletions git-fastclone.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ Gem::Specification.new do |gem|
gem.homepage = 'http://square.github.io/git-fastclone/'
gem.license = 'Apache'

gem.required_ruby_version = '>= 2.7'
gem.required_ruby_version = '>= 3.2'

gem.add_runtime_dependency 'colorize'
gem.add_dependency 'colorize'
gem.metadata['rubygems_mfa_required'] = 'true'
end
8 changes: 4 additions & 4 deletions lib/git-fastclone.rb
Original file line number Diff line number Diff line change
Expand Up @@ -293,26 +293,26 @@ def thread_update_submodule(submodule_url, submodule_path, threads, pwd)
end
end

def with_reference_repo_lock(url, &block)
def with_reference_repo_lock(url, &)
# Sane POSIX implementations remove exclusive flocks when a process is terminated or killed
# We block here indefinitely. Waiting for other git-fastclone processes to release the lock.
# With the default timeout of 0 we will wait forever, this can be overridden on the command line.
lockfile = reference_repo_lock_file(url, reference_dir, using_local_repo)
Timeout.timeout(flock_timeout_secs) { lockfile.flock(File::LOCK_EX) }
with_reference_repo_thread_lock(url, &block)
with_reference_repo_thread_lock(url, &)
ensure
# Not strictly necessary to do this unlock as an ensure. If ever exception is caught outside this
# primitive, ensure protection may come in handy.
lockfile.flock(File::LOCK_UN)
lockfile.close
end

def with_reference_repo_thread_lock(url, &block)
def with_reference_repo_thread_lock(url, &)
# We also need thread level locking because pre-fetch means multiple threads can
# attempt to update the same repository from a single git-fastclone process
# file locks in posix are tracked per process, not per userland thread.
# This gives us the equivalent of pthread_mutex around these accesses.
reference_mutex[reference_repo_name(url)].synchronize(&block)
reference_mutex[reference_repo_name(url)].synchronize(&)
end

def update_submodule_reference(url, submodule_url_list)
Expand Down
1 change: 0 additions & 1 deletion spec/git_fastclone_runner_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ def create_lockfile_double
it 'should initialize properly' do
stub_const('GitFastClone::DEFAULT_REFERENCE_REPO_DIR', 'new_dir')

expect(Hash).to respond_to(:new).with(2).arguments
expect(GitFastClone::DEFAULT_REFERENCE_REPO_DIR).to eq('new_dir')
expect(subject.prefetch_submodules).to eq(true)
expect(subject.reference_mutex).to eq({})
Expand Down