Singularise only_paths (now only_path)
This commit is contained in:
parent
6219cd0a92
commit
b11df3bef8
@ -15,7 +15,7 @@ class URL < Delegator
|
|||||||
:verified, :using,
|
:verified, :using,
|
||||||
:tag, :branch, :revisions, :revision,
|
:tag, :branch, :revisions, :revision,
|
||||||
:trust_cert, :cookies, :referer, :header, :user_agent,
|
:trust_cert, :cookies, :referer, :header, :user_agent,
|
||||||
:data, :only_paths
|
:data, :only_path
|
||||||
|
|
||||||
extend Forwardable
|
extend Forwardable
|
||||||
def_delegators :uri, :path, :scheme, :to_s
|
def_delegators :uri, :path, :scheme, :to_s
|
||||||
@ -36,7 +36,7 @@ class URL < Delegator
|
|||||||
header: T.nilable(String),
|
header: T.nilable(String),
|
||||||
user_agent: T.nilable(T.any(Symbol, String)),
|
user_agent: T.nilable(T.any(Symbol, String)),
|
||||||
data: T.nilable(T::Hash[String, String]),
|
data: T.nilable(T::Hash[String, String]),
|
||||||
only_paths: T.nilable(T::Array[String]),
|
only_path: T.nilable(String),
|
||||||
).void
|
).void
|
||||||
}
|
}
|
||||||
def initialize(
|
def initialize(
|
||||||
@ -53,7 +53,7 @@ class URL < Delegator
|
|||||||
header: nil,
|
header: nil,
|
||||||
user_agent: nil,
|
user_agent: nil,
|
||||||
data: nil,
|
data: nil,
|
||||||
only_paths: nil
|
only_path: nil
|
||||||
)
|
)
|
||||||
|
|
||||||
@uri = URI(uri)
|
@uri = URI(uri)
|
||||||
@ -71,7 +71,7 @@ class URL < Delegator
|
|||||||
specs[:header] = @header = header
|
specs[:header] = @header = header
|
||||||
specs[:user_agent] = @user_agent = user_agent || :default
|
specs[:user_agent] = @user_agent = user_agent || :default
|
||||||
specs[:data] = @data = data
|
specs[:data] = @data = data
|
||||||
specs[:only_paths] = @only_paths = only_paths
|
specs[:only_path] = @only_path = only_path
|
||||||
|
|
||||||
@specs = specs.compact
|
@specs = specs.compact
|
||||||
end
|
end
|
||||||
@ -159,7 +159,7 @@ class URL < Delegator
|
|||||||
header: T.nilable(String),
|
header: T.nilable(String),
|
||||||
user_agent: T.nilable(T.any(Symbol, String)),
|
user_agent: T.nilable(T.any(Symbol, String)),
|
||||||
data: T.nilable(T::Hash[String, 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,
|
caller_location: Thread::Backtrace::Location,
|
||||||
dsl: T.nilable(Cask::DSL),
|
dsl: T.nilable(Cask::DSL),
|
||||||
block: T.nilable(T.proc.params(arg0: T.all(String, BlockDSL::PageWithURL)).returns(T.untyped)),
|
block: T.nilable(T.proc.params(arg0: T.all(String, BlockDSL::PageWithURL)).returns(T.untyped)),
|
||||||
@ -179,7 +179,7 @@ class URL < Delegator
|
|||||||
header: nil,
|
header: nil,
|
||||||
user_agent: nil,
|
user_agent: nil,
|
||||||
data: nil,
|
data: nil,
|
||||||
only_paths: nil,
|
only_path: nil,
|
||||||
caller_location: T.must(caller_locations).fetch(0),
|
caller_location: T.must(caller_locations).fetch(0),
|
||||||
dsl: nil,
|
dsl: nil,
|
||||||
&block
|
&block
|
||||||
@ -207,7 +207,7 @@ class URL < Delegator
|
|||||||
header: header,
|
header: header,
|
||||||
user_agent: user_agent,
|
user_agent: user_agent,
|
||||||
data: data,
|
data: data,
|
||||||
only_paths: only_paths,
|
only_path: only_path,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|||||||
@ -813,7 +813,7 @@ class GitDownloadStrategy < VCSDownloadStrategy
|
|||||||
def initialize(url, name, version, **meta)
|
def initialize(url, name, version, **meta)
|
||||||
# Needs to be before the call to `super`, as the VCSDownloadStrategy's
|
# Needs to be before the call to `super`, as the VCSDownloadStrategy's
|
||||||
# constructor calls `cache_tag` and sets the cache path.
|
# constructor calls `cache_tag` and sets the cache path.
|
||||||
@only_paths = meta[:only_paths]
|
@only_path = meta[:only_path]
|
||||||
|
|
||||||
super
|
super
|
||||||
@ref_type ||= :branch
|
@ref_type ||= :branch
|
||||||
@ -889,7 +889,7 @@ class GitDownloadStrategy < VCSDownloadStrategy
|
|||||||
end
|
end
|
||||||
|
|
||||||
def partial_clone_sparse_checkout?
|
def partial_clone_sparse_checkout?
|
||||||
return false if @only_paths.blank?
|
return false if @only_path.blank?
|
||||||
|
|
||||||
Utils::Git.supports_partial_clone_sparse_checkout?
|
Utils::Git.supports_partial_clone_sparse_checkout?
|
||||||
end
|
end
|
||||||
@ -1052,8 +1052,7 @@ class GitDownloadStrategy < VCSDownloadStrategy
|
|||||||
args: ["config", "core.sparseCheckout", "true"],
|
args: ["config", "core.sparseCheckout", "true"],
|
||||||
chdir: cached_location
|
chdir: cached_location
|
||||||
|
|
||||||
sparse_checkout_paths = "#{@only_paths.join("\n")}\n"
|
(git_dir/"info"/"sparse-checkout").atomic_write("#{@only_path}\n")
|
||||||
(git_dir/"info"/"sparse-checkout").atomic_write(sparse_checkout_paths)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user