Ggit.Config¶
| Subclasses: | None | 
|---|
Methods¶
| Inherited: | GObject.Object (37) | 
|---|---|
| Structs: | GObject.ObjectClass (5) | 
| class | find_global() | 
| class | find_system() | 
| class | new() | 
| class | new_default() | 
| class | new_from_file(file) | 
| add_file(file, level, force) | |
| delete_entry(name) | |
| foreach(callback, *user_data) | |
| get_bool(name) | |
| get_entry(name) | |
| get_int32(name) | |
| get_int64(name) | |
| get_string(name) | |
| match(regex) | |
| match_foreach(regex, callback, *user_data) | |
| open_level(level) | |
| set_bool(name, value) | |
| set_int32(name, value) | |
| set_int64(name, value) | |
| set_string(name, value) | |
| snapshot() | 
Virtual Methods¶
| Inherited: | GObject.Object (7) | 
|---|
Properties¶
| Inherited: | Ggit.Native (1) | 
|---|
Signals¶
| Inherited: | GObject.Object (1) | 
|---|
Fields¶
| Inherited: | GObject.Object (1) | 
|---|
Class Details¶
- 
class Ggit.Config(**kwargs)¶
- Bases: - Ggit.Native- Abstract: - No - Structure: - Ggit.ConfigClass- Represents a git configuration. - 
classmethod find_global()¶
- Returns: - a - Gio.Fileor- Noneif the global config could not be found.- Return type: - Gio.File- Find the file representing the users global git configuration. This file is usually located at $HOME/.gitconfig. This function will try to guess the full path to that file, if the file exists. The returned file may then be used with - Ggit.Config.new_from_fileor- Ggit.Config.add_file. This function returns- Noneif the global config could not be found.
 - 
classmethod find_system()¶
- Returns: - a - Gio.Fileor- Noneif the system config could not be found.- Return type: - Gio.File- Find the file representing the systems global git configuration. This file is usually located at /etc/gitconfig on UNIX type systems or %PROGRAMFILES%\Git\etc\gitconfig on windows. This function will try to guess the full path to that file, if the file exists. The returned file may then be used with - Ggit.Config.new_from_fileor- Ggit.Config.add_file. This function returns- Noneif the system config could not be found.
 - 
classmethod new()¶
- Returns: - a - Ggit.Config.- Return type: - Ggit.Config- Create a new config. See also ggit_config_get_default() to get a - Ggit.Configrepresenting the global, XDG and system configuration files. To get a- Ggit.Configfor a repository use- Ggit.Repository.get_configinstead.
 - 
classmethod new_default()¶
- Raises: - GLib.Error- Returns: - A - Ggit.Config- Return type: - Ggit.Config- Get the global, XDG and system configuration files merged into one - Ggit.Configwith their appropriate priority levels. If an error occured trying to load the various configuration files, this function will return- Noneand error will be set accordingly.
 - 
classmethod new_from_file(file)¶
- Parameters: - file ( - Gio.File) – the file to load.- Raises: - GLib.Error- Returns: - a - Ggit.Config.- Return type: - Ggit.Config- Create a new config from a single on disk file. This is a convenience API and is exactly the same as creating an empty - Ggit.Configusing- Ggit.Config.newand adding the file with- Ggit.Config.add_file. The level will be set to- Ggit.ConfigLevel.LOCAL. If the config could not be loaded this function returns- Noneand error will be set accordingly.
 - 
add_file(file, level, force)¶
- Parameters: - file (Gio.File) – aGio.File.
- level (Ggit.ConfigLevel) – aGgit.ConfigLevel.
- force (bool) – if a config file already exists for the given priority level, replace it.
 - Raises: - Add an on-disk config file instance to an existing config - The on-disk file pointed at by file will be opened and parsed; it’s expected to be a native Git config file following the default Git config syntax (see man git-config). - Further queries on this config object will access each of the config file instances in order (instances with a higher priority level will be accessed first). 
- file (
 - 
delete_entry(name)¶
- Parameters: - name ( - str) – the configuration value.- Raises: - GLib.Error- Returns: - Trueif the configuration value was deleted,- Falseotherwise.- Return type: - bool- Delete a config variable from the config file. 
 - 
foreach(callback, *user_data)¶
- Parameters: - callback (Ggit.ConfigCallback) – aGgit.ConfigCallback.
- user_data (objectorNone) – the user data for callback.
 - Raises: - Returns: - Return type: - Call callback for each configuration value. 
- callback (
 - 
get_bool(name)¶
- Parameters: - name ( - str) – the name of the configuration value.- Raises: - GLib.Error- Returns: - the value. - Return type: - bool- Get a boolean configuration value. 
 - 
get_entry(name)¶
- Parameters: - name ( - str) – the configuration name.- Raises: - GLib.Error- Returns: - the entry of name, or - Noneif such a value does not exist.- Return type: - Ggit.ConfigEntry- Get - Ggit.ConfigEntryof a config variable.
 - 
get_int32(name)¶
- Parameters: - name ( - str) – the name of the configuration value.- Raises: - GLib.Error- Returns: - the value. - Return type: - int- Get a int32 configuration value. 
 - 
get_int64(name)¶
- Parameters: - name ( - str) – the name of the configuration value.- Raises: - GLib.Error- Returns: - the value. - Return type: - int- Get a int64 configuration value. 
 - 
get_string(name)¶
- Parameters: - name ( - str) – the name of the configuration value.- Raises: - GLib.Error- Returns: - the string value of name, or - Noneif such a value does not exist- Return type: - stror- None- Get the configuration value of name as string. 
 - 
match(regex)¶
- Parameters: - regex ( - GLib.Regex) – a- GLib.Regex.- Raises: - GLib.Error- Returns: - the value of that matched configuration - match_info: - a - GLib.MatchInfo.- Return type: - ( - stror- None, match_info:- GLib.MatchInfo)- Matches a configuration against a regular expression. match_info will contain the match information if the return value is not - None, otherwise error will be set.
 - 
match_foreach(regex, callback, *user_data)¶
- Parameters: - regex (GLib.Regex) – aGLib.Regex.
- callback (Ggit.ConfigMatchCallback) – aGgit.ConfigMatchCallback.
- user_data (objectorNone) – the user data for callback.
 - Raises: - Returns: - Return type: - Call callback for all configurations matching regex. 
- regex (
 - 
open_level(level)¶
- Parameters: - level ( - Ggit.ConfigLevel) – the level to open.- Raises: - GLib.Error- Returns: - the configuration at level, or - None.- Return type: - Ggit.Config- Open a specific level config derived from a multi-level one. 
 - 
set_bool(name, value)¶
- Parameters: - Raises: - Returns: - Return type: - Set a boolean value. 
 - 
set_int32(name, value)¶
- Parameters: - Raises: - Returns: - Return type: - Set a int32 value. 
 - 
set_int64(name, value)¶
- Parameters: - Raises: - Returns: - Return type: - Set a int64 value. 
 - 
set_string(name, value)¶
- Parameters: - Raises: - Returns: - Return type: - Set a new string value of a configuration. 
 - 
snapshot()¶
- Raises: - GLib.Error- Returns: - a new - Ggit.Config, or- Noneif an error occurred.- Return type: - Ggit.Config- Create a snapshot of the current state of the configuration, which allows you to look into a consistent view of the configuration for looking up complex values (e.g. a remote, submodule). 
 
- 
classmethod