Stop using shallow clones for taps
This commit is contained in:
parent
2dc6ff13cf
commit
674594f75c
@ -27,11 +27,6 @@ module Homebrew
|
|||||||
assumptions, so taps can be cloned from places other than GitHub and
|
assumptions, so taps can be cloned from places other than GitHub and
|
||||||
using protocols other than HTTPS, e.g. SSH, git, HTTP, FTP(S), rsync.
|
using protocols other than HTTPS, e.g. SSH, git, HTTP, FTP(S), rsync.
|
||||||
EOS
|
EOS
|
||||||
switch "--full",
|
|
||||||
description: "Convert a shallow clone to a full clone without untapping. Taps are only cloned as "\
|
|
||||||
"shallow clones if `--shallow` was originally passed."
|
|
||||||
switch "--shallow",
|
|
||||||
description: "Fetch tap as a shallow clone rather than a full clone. Useful for continuous integration."
|
|
||||||
switch "--force-auto-update",
|
switch "--force-auto-update",
|
||||||
description: "Auto-update tap even if it is not hosted on GitHub. By default, only taps "\
|
description: "Auto-update tap even if it is not hosted on GitHub. By default, only taps "\
|
||||||
"hosted on GitHub are auto-updated (for performance reasons)."
|
"hosted on GitHub are auto-updated (for performance reasons)."
|
||||||
@ -56,18 +51,11 @@ module Homebrew
|
|||||||
elsif args.no_named?
|
elsif args.no_named?
|
||||||
puts Tap.names
|
puts Tap.names
|
||||||
else
|
else
|
||||||
full_clone = if args.full?
|
|
||||||
true
|
|
||||||
else
|
|
||||||
!args.shallow?
|
|
||||||
end
|
|
||||||
odebug "Tapping as #{full_clone ? "full" : "shallow"} clone"
|
|
||||||
tap = Tap.fetch(args.named.first)
|
tap = Tap.fetch(args.named.first)
|
||||||
begin
|
begin
|
||||||
tap.install clone_target: args.named.second,
|
tap.install clone_target: args.named.second,
|
||||||
force_auto_update: force_auto_update?(args: args),
|
force_auto_update: force_auto_update?(args: args),
|
||||||
quiet: args.quiet?,
|
quiet: args.quiet?
|
||||||
full_clone: full_clone
|
|
||||||
rescue TapRemoteMismatchError => e
|
rescue TapRemoteMismatchError => e
|
||||||
odie e
|
odie e
|
||||||
rescue TapAlreadyTappedError
|
rescue TapAlreadyTappedError
|
||||||
|
@ -244,9 +244,8 @@ class Tap
|
|||||||
# @param clone_target [String] If passed, it will be used as the clone remote.
|
# @param clone_target [String] If passed, it will be used as the clone remote.
|
||||||
# @param force_auto_update [Boolean, nil] If present, whether to override the
|
# @param force_auto_update [Boolean, nil] If present, whether to override the
|
||||||
# logic that skips non-GitHub repositories during auto-updates.
|
# logic that skips non-GitHub repositories during auto-updates.
|
||||||
# @param full_clone [Boolean] If set as true, full clone will be used. If unset/nil, means "no change".
|
|
||||||
# @param quiet [Boolean] If set, suppress all output.
|
# @param quiet [Boolean] If set, suppress all output.
|
||||||
def install(full_clone: true, quiet: false, clone_target: nil, force_auto_update: nil)
|
def install(quiet: false, clone_target: nil, force_auto_update: nil)
|
||||||
require "descriptions"
|
require "descriptions"
|
||||||
require "readall"
|
require "readall"
|
||||||
|
|
||||||
@ -270,11 +269,13 @@ class Tap
|
|||||||
if installed?
|
if installed?
|
||||||
unless force_auto_update.nil?
|
unless force_auto_update.nil?
|
||||||
config["forceautoupdate"] = force_auto_update
|
config["forceautoupdate"] = force_auto_update
|
||||||
return if !full_clone || !shallow?
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
$stderr.ohai "Unshallowing #{name}" unless quiet
|
$stderr.ohai "Unshallowing #{name}" if shallow? && !quiet
|
||||||
args = %w[fetch --unshallow]
|
args = %w[fetch]
|
||||||
|
# Git throws an error when attempting to unshallow a full clone
|
||||||
|
args << "--unshallow" if shallow?
|
||||||
args << "-q" if quiet
|
args << "-q" if quiet
|
||||||
path.cd { safe_system "git", *args }
|
path.cd { safe_system "git", *args }
|
||||||
return
|
return
|
||||||
@ -288,7 +289,6 @@ class Tap
|
|||||||
# Override possible user configs like:
|
# Override possible user configs like:
|
||||||
# git config --global clone.defaultRemoteName notorigin
|
# git config --global clone.defaultRemoteName notorigin
|
||||||
args << "--origin=origin"
|
args << "--origin=origin"
|
||||||
args << "--depth=1" unless full_clone
|
|
||||||
args << "-q" if quiet
|
args << "-q" if quiet
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
Loading…
x
Reference in New Issue
Block a user