Merge pull request #15542 from hmarr/sparse-checkout-cone-mode
This commit is contained in:
commit
a56a270707
@ -835,6 +835,12 @@ class GitDownloadStrategy < VCSDownloadStrategy
|
|||||||
# constructor calls `cache_tag` and sets the cache path.
|
# constructor calls `cache_tag` and sets the cache path.
|
||||||
@only_path = meta[:only_path]
|
@only_path = meta[:only_path]
|
||||||
|
|
||||||
|
if @only_path.present?
|
||||||
|
# "Cone" mode of sparse checkout requires patterns to be directories
|
||||||
|
@only_path = "/#{@only_path}" unless @only_path.start_with?("/")
|
||||||
|
@only_path = "#{@only_path}/" unless @only_path.end_with?("/")
|
||||||
|
end
|
||||||
|
|
||||||
super
|
super
|
||||||
@ref_type ||= :branch
|
@ref_type ||= :branch
|
||||||
@ref ||= "master"
|
@ref ||= "master"
|
||||||
@ -1075,9 +1081,12 @@ class GitDownloadStrategy < VCSDownloadStrategy
|
|||||||
command! "git",
|
command! "git",
|
||||||
args: ["config", "core.sparseCheckout", "true"],
|
args: ["config", "core.sparseCheckout", "true"],
|
||||||
chdir: cached_location
|
chdir: cached_location
|
||||||
|
command! "git",
|
||||||
|
args: ["config", "core.sparseCheckoutCone", "true"],
|
||||||
|
chdir: cached_location
|
||||||
|
|
||||||
(git_dir/"info").mkpath
|
(git_dir/"info").mkpath
|
||||||
(git_dir/"info"/"sparse-checkout").atomic_write("#{@only_path}\n")
|
(git_dir/"info/sparse-checkout").atomic_write("#{@only_path}\n")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user