From b11df3bef825417b4d67ed9b5639f206e20851bf Mon Sep 17 00:00:00 2001 From: Harry Marr Date: Sat, 22 Oct 2022 10:53:02 -0400 Subject: [PATCH] Singularise `only_paths` (now `only_path`) --- Library/Homebrew/cask/url.rb | 14 +++++++------- Library/Homebrew/download_strategy.rb | 7 +++---- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/Library/Homebrew/cask/url.rb b/Library/Homebrew/cask/url.rb index f692b0f0e5..a59e1f07b1 100644 --- a/Library/Homebrew/cask/url.rb +++ b/Library/Homebrew/cask/url.rb @@ -15,7 +15,7 @@ class URL < Delegator :verified, :using, :tag, :branch, :revisions, :revision, :trust_cert, :cookies, :referer, :header, :user_agent, - :data, :only_paths + :data, :only_path extend Forwardable def_delegators :uri, :path, :scheme, :to_s @@ -36,7 +36,7 @@ class URL < Delegator header: T.nilable(String), user_agent: T.nilable(T.any(Symbol, String)), data: T.nilable(T::Hash[String, String]), - only_paths: T.nilable(T::Array[String]), + only_path: T.nilable(String), ).void } def initialize( @@ -53,7 +53,7 @@ class URL < Delegator header: nil, user_agent: nil, data: nil, - only_paths: nil + only_path: nil ) @uri = URI(uri) @@ -71,7 +71,7 @@ class URL < Delegator specs[:header] = @header = header specs[:user_agent] = @user_agent = user_agent || :default specs[:data] = @data = data - specs[:only_paths] = @only_paths = only_paths + specs[:only_path] = @only_path = only_path @specs = specs.compact end @@ -159,7 +159,7 @@ class URL < Delegator header: T.nilable(String), user_agent: T.nilable(T.any(Symbol, String)), data: T.nilable(T::Hash[String, String]), - only_paths: T.nilable(T::Array[String]), + only_path: T.nilable(String), caller_location: Thread::Backtrace::Location, dsl: T.nilable(Cask::DSL), block: T.nilable(T.proc.params(arg0: T.all(String, BlockDSL::PageWithURL)).returns(T.untyped)), @@ -179,7 +179,7 @@ class URL < Delegator header: nil, user_agent: nil, data: nil, - only_paths: nil, + only_path: nil, caller_location: T.must(caller_locations).fetch(0), dsl: nil, &block @@ -207,7 +207,7 @@ class URL < Delegator header: header, user_agent: user_agent, data: data, - only_paths: only_paths, + only_path: only_path, ) end ) diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index 3d917eb7f6..3ce7303d47 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -813,7 +813,7 @@ class GitDownloadStrategy < VCSDownloadStrategy def initialize(url, name, version, **meta) # Needs to be before the call to `super`, as the VCSDownloadStrategy's # constructor calls `cache_tag` and sets the cache path. - @only_paths = meta[:only_paths] + @only_path = meta[:only_path] super @ref_type ||= :branch @@ -889,7 +889,7 @@ class GitDownloadStrategy < VCSDownloadStrategy end def partial_clone_sparse_checkout? - return false if @only_paths.blank? + return false if @only_path.blank? Utils::Git.supports_partial_clone_sparse_checkout? end @@ -1052,8 +1052,7 @@ class GitDownloadStrategy < VCSDownloadStrategy args: ["config", "core.sparseCheckout", "true"], chdir: cached_location - sparse_checkout_paths = "#{@only_paths.join("\n")}\n" - (git_dir/"info"/"sparse-checkout").atomic_write(sparse_checkout_paths) + (git_dir/"info"/"sparse-checkout").atomic_write("#{@only_path}\n") end end