Singularise only_paths (now only_path)

This commit is contained in:
Harry Marr 2022-10-22 10:53:02 -04:00
parent 6219cd0a92
commit b11df3bef8
No known key found for this signature in database
GPG Key ID: EC359447F66859CC
2 changed files with 10 additions and 11 deletions

View File

@ -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
)

View File

@ -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