mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
svn: add flags if needed for :trust_cert or remote_exists?
This commit is contained in:
parent
0e0593418d
commit
093e6e11da
@ -763,10 +763,7 @@ class SubversionDownloadStrategy < VCSDownloadStrategy
|
||||
|
||||
args << "--ignore-externals" if ignore_externals
|
||||
|
||||
if meta[:trust_cert] == true
|
||||
args << "--trust-server-cert"
|
||||
args << "--non-interactive"
|
||||
end
|
||||
args.concat Utils::Svn.invalid_cert_flags if meta[:trust_cert] == true
|
||||
|
||||
if target.directory?
|
||||
command! "svn", args: ["update", *args], chdir: target.to_s, timeout: timeout&.remaining
|
||||
|
@ -30,9 +30,22 @@ module Utils
|
||||
def remote_exists?(url)
|
||||
return true unless available?
|
||||
|
||||
args = ["ls", url, "--depth", "empty"]
|
||||
_, stderr, status = system_command("svn", args: args, print_stderr: false)
|
||||
return status.success? unless stderr.include?("certificate verification failed")
|
||||
|
||||
# OK to unconditionally trust here because we're just checking if a URL exists.
|
||||
system_command("svn", args: ["ls", url, "--depth", "empty",
|
||||
"--non-interactive", "--trust-server-cert"], print_stderr: false).success?
|
||||
system_command("svn", args: args.concat(invalid_cert_flags), print_stderr: false).success?
|
||||
end
|
||||
|
||||
sig { returns(Array) }
|
||||
def invalid_cert_flags
|
||||
opoo "Ignoring Subversion certificate errors!"
|
||||
args = ["--non-interactive", "--trust-server-cert"]
|
||||
if Version.create(version || "-1") >= Version.create("1.9")
|
||||
args << "--trust-server-cert-failures=expired,not-yet-valid"
|
||||
end
|
||||
args
|
||||
end
|
||||
|
||||
def clear_version_cache
|
||||
|
Loading…
x
Reference in New Issue
Block a user