mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Add --no-force-auto-update
option to brew tap
Enable this option to delete `homebrew.forceautoupdate` git config option
This commit is contained in:
parent
14ff6be6d0
commit
2e899da7c7
@ -311,6 +311,9 @@ module Homebrew
|
||||
|
||||
sig { returns(T::Boolean) }
|
||||
def print_path?; end
|
||||
|
||||
sig { returns(T.nilable(T::Boolean)) }
|
||||
def force_auto_update?; end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -34,7 +34,7 @@ module Homebrew
|
||||
switch "--shallow",
|
||||
description: "Fetch tap as a shallow clone rather than a full clone. Useful for continuous integration.",
|
||||
replacement: false
|
||||
switch "--force-auto-update",
|
||||
switch "--[no-]force-auto-update",
|
||||
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)."
|
||||
switch "--custom-remote",
|
||||
@ -63,7 +63,7 @@ module Homebrew
|
||||
tap = Tap.fetch(args.named.first)
|
||||
begin
|
||||
tap.install clone_target: args.named.second,
|
||||
force_auto_update: force_auto_update?(args: args),
|
||||
force_auto_update: args.force_auto_update?,
|
||||
custom_remote: args.custom_remote?,
|
||||
quiet: args.quiet?
|
||||
rescue TapRemoteMismatchError, TapNoCustomRemoteError => e
|
||||
@ -73,9 +73,4 @@ module Homebrew
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def force_auto_update?(args:)
|
||||
# if no relevant flag is present, return nil, meaning "no change"
|
||||
true if args.force_auto_update?
|
||||
end
|
||||
end
|
||||
|
@ -276,7 +276,11 @@ class Tap
|
||||
end
|
||||
|
||||
unless force_auto_update.nil?
|
||||
config["forceautoupdate"] = force_auto_update
|
||||
if force_auto_update
|
||||
config["forceautoupdate"] = force_auto_update
|
||||
elsif config["forceautoupdate"] == "true"
|
||||
config.delete("forceautoupdate")
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
@ -932,6 +936,13 @@ class TapConfig
|
||||
|
||||
Homebrew::Settings.write key, value.to_s, repo: tap.path
|
||||
end
|
||||
|
||||
def delete(key)
|
||||
return unless tap.git?
|
||||
return unless Utils::Git.available?
|
||||
|
||||
Homebrew::Settings.delete key, repo: tap.path
|
||||
end
|
||||
end
|
||||
|
||||
require "extend/os/tap"
|
||||
|
@ -337,7 +337,7 @@ describe Tap do
|
||||
it "disables forced auto-updates when false" do
|
||||
expect(already_tapped_tap).to be_installed
|
||||
already_tapped_tap.install force_auto_update: false
|
||||
expect(already_tapped_tap.config["forceautoupdate"]).to eq("false")
|
||||
expect(already_tapped_tap.config["forceautoupdate"]).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
@ -453,7 +453,7 @@ describe Tap do
|
||||
expect(homebrew_foo_tap.config["foo"]).to be_nil
|
||||
homebrew_foo_tap.config["foo"] = "bar"
|
||||
expect(homebrew_foo_tap.config["foo"]).to eq("bar")
|
||||
homebrew_foo_tap.config["foo"] = nil
|
||||
homebrew_foo_tap.config.delete("foo")
|
||||
expect(homebrew_foo_tap.config["foo"]).to be_nil
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user