Module: Git::Repository::Configuring
- Included in:
- Git::Repository
- Defined in:
- lib/git/repository/configuring.rb
Overview
Legacy facade methods for reading and writing git configuration
Provides the #config and #global_config dispatch methods for 4.x
compatibility. These methods return raw String / Hash values instead of
ConfigEntryInfo objects and are retained so that internal callers such
as Git::Status continue to work unchanged.
The structured config_* methods (e.g. config_get, config_list) are
provided by Configuring, which is included directly into
Git::Repository.
Included by Git::Repository.
Instance Method Summary collapse
-
#config(name = nil, value = nil, options = {})
Read or write a git configuration entry.
-
#global_config(name = nil, value = nil)
Read or write a global git configuration entry.
Instance Method Details
#config(options = {}) ⇒ Hash{String => String} #config(name, options = {}) ⇒ String #config(name, value, options = {}) ⇒ Git::CommandLineResult
Read or write a git configuration entry
Dispatches to one of three modes depending on the arguments supplied:
- List —
config()returns all visible config entries as aHash. - Get —
config(name)returns the value for a single key as aString. - Set —
config(name, value)writes a value and returns the raw command result.
110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/git/repository/configuring.rb', line 110 def config(name = nil, value = nil, = {}) name, value, = Private.normalize_config_args(name, value, ) if !name.nil? && !value.nil? Private.config_set(@execution_context, name, value, **) elsif name Private.config_get(@execution_context, name, **) else Private.config_list(@execution_context, **) end end |
#global_config ⇒ Hash{String => String} #global_config(name) ⇒ String #global_config(name, value) ⇒ Git::CommandLineResult
Read or write a global git configuration entry
Dispatches to one of three modes depending on the arguments supplied,
targeting the git global config scope (git config --global):
- List —
global_config()returns all global config entries as aHash. - Get —
global_config(name)returns the value for a single key as aString. - Set —
global_config(name, value)writes a value and returns the raw command result.
168 169 170 171 172 173 174 175 176 |
# File 'lib/git/repository/configuring.rb', line 168 def global_config(name = nil, value = nil) if !name.nil? && !value.nil? Private.global_config_set(@execution_context, name, value) elsif !name.nil? Private.global_config_get(@execution_context, name) else Private.global_config_list(@execution_context) end end |