jekyll(fetch_remote): set fetch depth 0 if not a local build

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2022-10-27 00:07:44 +02:00
parent 5f1b0f4f36
commit a96dd76048
No known key found for this signature in database
GPG Key ID: 3248E46B6BB8C7F7
1 changed files with 4 additions and 2 deletions

View File

@ -40,6 +40,8 @@ module Jekyll
def pre_read(site)
beginning_time = Time.now
puts "Starting plugin fetch_remote.rb..."
fetch_depth = get_docs_url == "http://localhost:4000" ? 1 : 0
site.config['fetch-remote'].each do |entry|
puts " Repo #{entry['repo']}"
@ -55,11 +57,11 @@ module Jekyll
rescue => e
FileUtils.rm_rf(clonedir)
puts " Cloning repository into #{clonedir}"
git = Git.clone("#{entry['repo']}.git", Pathname.new(clonedir), branch: entry['ref'], depth: 1)
git = Git.clone("#{entry['repo']}.git", Pathname.new(clonedir), branch: entry['ref'], depth: fetch_depth)
end
else
puts " Cloning repository into #{clonedir}"
git = Git.clone("#{entry['repo']}.git", Pathname.new(clonedir), branch: entry['ref'], depth: 1)
git = Git.clone("#{entry['repo']}.git", Pathname.new(clonedir), branch: entry['ref'], depth: fetch_depth)
end
entry['paths'].each do |path|