summaryrefslogtreecommitdiff
path: root/src/other_tools/git_operations/git_config_settings.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/other_tools/git_operations/git_config_settings.hpp')
-rw-r--r--src/other_tools/git_operations/git_config_settings.hpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/other_tools/git_operations/git_config_settings.hpp b/src/other_tools/git_operations/git_config_settings.hpp
index 8aa412e8..afe8a73b 100644
--- a/src/other_tools/git_operations/git_config_settings.hpp
+++ b/src/other_tools/git_operations/git_config_settings.hpp
@@ -33,6 +33,9 @@ using git_transport_certificate_check_cb = auto (*)(git_cert*,
using anon_logger_t = std::function<void(std::string const&, bool)>;
using anon_logger_ptr = std::shared_ptr<anon_logger_t>;
+/// \brief Contains the proxy URL if proxy is set, or nullopt if proxy unset.
+using ProxyInfo = std::optional<std::string>;
+
namespace GitConfigSettings {
/// \brief Get a custom SSL certificate check callback to honor the existing
@@ -44,6 +47,14 @@ namespace GitConfigSettings {
anon_logger_ptr const& logger)
-> std::optional<git_transport_certificate_check_cb>;
+/// \brief Get the remote proxy settings from envariables and the given git
+/// config snapshot. Performs same checks and honors same settings as git.
+/// Returns the proxy state and information, or nullopt if errors.
+[[nodiscard]] auto GetProxySettings(std::shared_ptr<git_config> const& cfg,
+ std::string const& url,
+ anon_logger_ptr const& logger)
+ -> std::optional<ProxyInfo>;
+
} // namespace GitConfigSettings
#endif // INCLUDED_SRC_OTHER_TOOLS_GIT_OPERATIONS_GIT_CONFIG_SETTINGS_HPP