commit
3eaa0d7752
@ -56,18 +56,23 @@ module Homebrew
|
||||
elsif args.no_named?
|
||||
puts Tap.names
|
||||
else
|
||||
full_clone = if args.full?
|
||||
true
|
||||
else
|
||||
!args.shallow?
|
||||
if args.full?
|
||||
opoo "`brew tap --full` is now a no-op!"
|
||||
# TODO: (3.2) Uncomment the following line and remove the `opoo` above
|
||||
# odeprecated "`brew tap --full`"
|
||||
end
|
||||
odebug "Tapping as #{full_clone ? "full" : "shallow"} clone"
|
||||
|
||||
if args.shallow?
|
||||
opoo "`brew tap --shallow` is now a no-op!"
|
||||
# TODO: (3.2) Uncomment the following line and remove the `opoo` above
|
||||
# odeprecated "`brew tap --shallow`"
|
||||
end
|
||||
|
||||
tap = Tap.fetch(args.named.first)
|
||||
begin
|
||||
tap.install clone_target: args.named.second,
|
||||
force_auto_update: force_auto_update?(args: args),
|
||||
quiet: args.quiet?,
|
||||
full_clone: full_clone
|
||||
quiet: args.quiet?
|
||||
rescue TapRemoteMismatchError => e
|
||||
odie e
|
||||
rescue TapAlreadyTappedError
|
||||
|
||||
@ -244,9 +244,8 @@ class Tap
|
||||
# @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
|
||||
# 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.
|
||||
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 "readall"
|
||||
|
||||
@ -270,11 +269,13 @@ class Tap
|
||||
if installed?
|
||||
unless force_auto_update.nil?
|
||||
config["forceautoupdate"] = force_auto_update
|
||||
return if !full_clone || !shallow?
|
||||
return
|
||||
end
|
||||
|
||||
$stderr.ohai "Unshallowing #{name}" unless quiet
|
||||
args = %w[fetch --unshallow]
|
||||
$stderr.ohai "Unshallowing #{name}" if shallow? && !quiet
|
||||
args = %w[fetch]
|
||||
# Git throws an error when attempting to unshallow a full clone
|
||||
args << "--unshallow" if shallow?
|
||||
args << "-q" if quiet
|
||||
path.cd { safe_system "git", *args }
|
||||
return
|
||||
@ -288,7 +289,6 @@ class Tap
|
||||
# Override possible user configs like:
|
||||
# git config --global clone.defaultRemoteName notorigin
|
||||
args << "--origin=origin"
|
||||
args << "--depth=1" unless full_clone
|
||||
args << "-q" if quiet
|
||||
|
||||
begin
|
||||
@ -736,14 +736,12 @@ class CoreTap < Tap
|
||||
end
|
||||
|
||||
# CoreTap never allows shallow clones (on request from GitHub).
|
||||
def install(full_clone: true, quiet: false, clone_target: nil, force_auto_update: nil)
|
||||
raise "Shallow clones are not supported for homebrew-core!" unless full_clone
|
||||
|
||||
def install(quiet: false, clone_target: nil, force_auto_update: nil)
|
||||
remote = Homebrew::EnvConfig.core_git_remote
|
||||
if remote != default_remote
|
||||
$stderr.puts "HOMEBREW_CORE_GIT_REMOTE set: using #{remote} for Homebrew/core Git remote URL."
|
||||
end
|
||||
super(full_clone: full_clone, quiet: quiet, clone_target: remote, force_auto_update: force_auto_update)
|
||||
super(quiet: quiet, clone_target: remote, force_auto_update: force_auto_update)
|
||||
end
|
||||
|
||||
# @private
|
||||
|
||||
@ -9,7 +9,7 @@ describe "brew tap" do
|
||||
it "taps a given Tap", :integration_test do
|
||||
path = setup_test_tap
|
||||
|
||||
expect { brew "tap", "--force-auto-update", "--full", "homebrew/bar", path/".git" }
|
||||
expect { brew "tap", "--force-auto-update", "homebrew/bar", path/".git" }
|
||||
.to output(/Tapped/).to_stderr
|
||||
.and be_a_success
|
||||
end
|
||||
|
||||
@ -220,7 +220,7 @@ RSpec.shared_context "integration test" do # rubocop:disable RSpec/ContextWordin
|
||||
system "git", "clone", "--shared", system_tap_path, tap.path
|
||||
system "git", "-C", tap.path, "checkout", "master"
|
||||
else
|
||||
tap.install(full_clone: false, quiet: true)
|
||||
tap.install(quiet: true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -1882,12 +1882,10 @@ _brew_tap() {
|
||||
__brewcomp "
|
||||
--debug
|
||||
--force-auto-update
|
||||
--full
|
||||
--help
|
||||
--list-pinned
|
||||
--quiet
|
||||
--repair
|
||||
--shallow
|
||||
--verbose
|
||||
"
|
||||
return
|
||||
|
||||
@ -1266,12 +1266,10 @@ __fish_brew_complete_arg 'style; and not __fish_seen_argument -l formula -l form
|
||||
__fish_brew_complete_cmd 'tap' 'Tap a formula repository'
|
||||
__fish_brew_complete_arg 'tap' -l debug -d 'Display any debugging information'
|
||||
__fish_brew_complete_arg 'tap' -l force-auto-update -d 'Auto-update tap even if it is not hosted on GitHub. By default, only taps hosted on GitHub are auto-updated (for performance reasons)'
|
||||
__fish_brew_complete_arg 'tap' -l full -d 'Convert a shallow clone to a full clone without untapping. Taps are only cloned as shallow clones if `--shallow` was originally passed'
|
||||
__fish_brew_complete_arg 'tap' -l help -d 'Show this message'
|
||||
__fish_brew_complete_arg 'tap' -l list-pinned -d 'List all pinned taps'
|
||||
__fish_brew_complete_arg 'tap' -l quiet -d 'Make some output more quiet'
|
||||
__fish_brew_complete_arg 'tap' -l repair -d 'Migrate tapped formulae from symlink-based to directory-based structure'
|
||||
__fish_brew_complete_arg 'tap' -l shallow -d 'Fetch tap as a shallow clone rather than a full clone. Useful for continuous integration'
|
||||
__fish_brew_complete_arg 'tap' -l verbose -d 'Make some output more verbose'
|
||||
__fish_brew_complete_arg 'tap' -a '(__fish_brew_suggest_taps_installed)'
|
||||
|
||||
|
||||
@ -1557,12 +1557,10 @@ _brew_tap() {
|
||||
_arguments \
|
||||
'--debug[Display any debugging information]' \
|
||||
'--force-auto-update[Auto-update tap even if it is not hosted on GitHub. By default, only taps hosted on GitHub are auto-updated (for performance reasons)]' \
|
||||
'--full[Convert a shallow clone to a full clone without untapping. Taps are only cloned as shallow clones if `--shallow` was originally passed]' \
|
||||
'--help[Show this message]' \
|
||||
'--list-pinned[List all pinned taps]' \
|
||||
'--quiet[Make some output more quiet]' \
|
||||
'--repair[Migrate tapped formulae from symlink-based to directory-based structure]' \
|
||||
'--shallow[Fetch tap as a shallow clone rather than a full clone. Useful for continuous integration]' \
|
||||
'--verbose[Make some output more verbose]' \
|
||||
- tap \
|
||||
'*::tap:__brew_any_tap'
|
||||
|
||||
@ -536,10 +536,6 @@ simplifies but also limits. This two-argument command makes no
|
||||
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.
|
||||
|
||||
* `--full`:
|
||||
Convert a shallow clone to a full clone without untapping. Taps are only cloned as shallow clones if `--shallow` was originally passed.
|
||||
* `--shallow`:
|
||||
Fetch tap as a shallow clone rather than a full clone. Useful for continuous integration.
|
||||
* `--force-auto-update`:
|
||||
Auto-update tap even if it is not hosted on GitHub. By default, only taps hosted on GitHub are auto-updated (for performance reasons).
|
||||
* `--repair`:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user