Skip to content

Commit 698cf14

Browse files
committed
Fetch only necessary commits of bundled gems
1 parent 3b17ff2 commit 698cf14

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

defs/gmake.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ $(srcdir)/.bundle/.timestamp:
365365
define build-gem
366366
$(srcdir)/gems/src/$(1)/.git: | $(srcdir)/gems/src
367367
$(ECHO) Cloning $(4)
368-
$(Q) $(GIT) clone $(4) $$(@D)
368+
$(Q) $(GIT) clone --depth=1 --no-tags $(4) $$(@D)
369369

370370
$(bundled-gem-revision): \
371371
$(if $(if $(wildcard $$(@)),$(filter $(3),$(shell cat $$(@)))),,PHONY) \

tool/fetch-bundled_gems.rb

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,22 @@
2424
next if n =~ /^#/
2525
next if bundled_gems&.all? {|pat| !File.fnmatch?(pat, n)}
2626

27-
if File.directory?(n)
28-
puts "updating #{color.notice(n)} ..."
29-
system("git", "fetch", "--all", chdir: n) or abort
30-
else
27+
unless File.exist?("#{n}/.git")
3128
puts "retrieving #{color.notice(n)} ..."
32-
system(*%W"git clone #{u} #{n}") or abort
29+
system(*%W"git clone --depth=1 --no-tags #{u} #{n}") or abort
3330
end
3431

3532
if r
3633
puts "fetching #{color.notice(r)} ..."
3734
system("git", "fetch", "origin", r, chdir: n) or abort
35+
c = r
36+
else
37+
c = ["v#{v}", v].find do |c|
38+
puts "fetching #{color.notice(c)} ..."
39+
system("git", "fetch", "origin", "refs/tags/#{c}:refs/tags/#{c}", chdir: n)
40+
end or abort
3841
end
3942

40-
c = r || "v#{v}"
4143
checkout = %w"git -c advice.detachedHead=false checkout"
4244
print %[checking out #{color.notice(c)} (v=#{color.info(v)}]
4345
print %[, r=#{color.info(r)}] if r

0 commit comments

Comments
 (0)