Top |
Functions
gint | (*GgitConfigCallback) () |
gint | (*GgitConfigMatchCallback) () |
GgitConfig * | ggit_config_new () |
GgitConfig * | ggit_config_new_default () |
GgitConfig * | ggit_config_new_from_file () |
GFile * | ggit_config_find_global () |
GFile * | ggit_config_find_system () |
void | ggit_config_add_file () |
gint32 | ggit_config_get_int32 () |
gboolean | ggit_config_set_int32 () |
gint64 | ggit_config_get_int64 () |
gboolean | ggit_config_set_int64 () |
gboolean | ggit_config_get_bool () |
gboolean | ggit_config_set_bool () |
const gchar * | ggit_config_get_string () |
gboolean | ggit_config_set_string () |
gboolean | ggit_config_delete_entry () |
gboolean | ggit_config_foreach () |
gchar * | ggit_config_match () |
gboolean | ggit_config_match_foreach () |
Functions
GgitConfigCallback ()
gint (*GgitConfigCallback) (GgitConfigEntry *entry
,gpointer user_data
);
The type of the callback functions for retrieving values from a GgitConfig.
See ggit_config_foreach()
.
GgitConfigMatchCallback ()
gint (*GgitConfigMatchCallback) (GMatchInfo *match_info
,const gchar *value
,gpointer user_data
);
The type of the callback functions for retrieving values from a GgitConfig
using a regular expression. See ggit_config_match_foreach()
.
ggit_config_new ()
GgitConfig *
ggit_config_new (void
);
Create a new config. See also ggit_config_get_default()
to get
a GgitConfig representing the global, XDG and system configuration files.
To get a GgitConfig for a repository use ggit_repository_get_config
instead.
ggit_config_new_default ()
GgitConfig *
ggit_config_new_default (GError **error
);
Get the global, XDG and system configuration files merged into one
GgitConfig with their appropriate priority levels. If an error occured
trying to load the various configuration files, this function will return
NULL
and error
will be set accordingly.
ggit_config_new_from_file ()
GgitConfig * ggit_config_new_from_file (GFile *file
,GError **error
);
Create a new config from a single on disk file. This is a convenience
API and is exactly the same as creating an empty GgitConfig using
ggit_config_new and adding the file with ggit_config_add_file. The
level will be set to GGIT_CONFIG_LEVEL_LOCAL. If the config could not be
loaded this function returns NULL
and error
will be set accordingly.
ggit_config_find_global ()
GFile *
ggit_config_find_global (void
);
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_file or ggit_config_add_file. This
function returns NULL
if the global config could not be found.
ggit_config_find_system ()
GFile *
ggit_config_find_system (void
);
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_file or ggit_config_add_file. This
function returns NULL
if the system config could not be found.
ggit_config_add_file ()
void ggit_config_add_file (GgitConfig *config
,GFile *file
,GgitConfigLevel level
,gboolean force
,GError **error
);
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).
Parameters
config |
a GgitConfig. |
|
file |
a GFile. |
|
level |
||
force |
if a config file already exists for the given priority level, replace it. |
|
error |
a GError for error reporting, or |
ggit_config_get_int32 ()
gint32 ggit_config_get_int32 (GgitConfig *config
,const gchar *name
,GError **error
);
Get a int32 configuration value.
Parameters
config |
a GgitConfig. |
|
name |
the name of the configuration value. |
|
error |
a GError for error reporting, or |
ggit_config_set_int32 ()
gboolean ggit_config_set_int32 (GgitConfig *config
,const gchar *name
,gint32 value
,GError **error
);
Set a int32 value.
Parameters
config |
a GgitConfig. |
|
name |
the name of the configuration value. |
|
value |
the new value. |
|
error |
a GError for error reporting, or |
ggit_config_get_int64 ()
gint64 ggit_config_get_int64 (GgitConfig *config
,const gchar *name
,GError **error
);
Get a int64 configuration value.
Parameters
config |
a GgitConfig. |
|
name |
the name of the configuration value. |
|
error |
a GError for error reporting, or |
ggit_config_set_int64 ()
gboolean ggit_config_set_int64 (GgitConfig *config
,const gchar *name
,gint64 value
,GError **error
);
Set a int64 value.
Parameters
config |
a GgitConfig. |
|
name |
the name of the configuration value. |
|
value |
the new value. |
|
error |
a GError for error reporting, or |
ggit_config_get_bool ()
gboolean ggit_config_get_bool (GgitConfig *config
,const gchar *name
,GError **error
);
Get a boolean configuration value.
Parameters
config |
a GgitConfig. |
|
name |
the name of the configuration value. |
|
error |
a GError for error reporting, or |
ggit_config_set_bool ()
gboolean ggit_config_set_bool (GgitConfig *config
,const gchar *name
,gboolean value
,GError **error
);
Set a boolean value.
Parameters
config |
a GgitConfig. |
|
name |
the name of the configuration value. |
|
value |
the new value. |
|
error |
a GError for error reporting, or |
ggit_config_get_string ()
const gchar * ggit_config_get_string (GgitConfig *config
,const gchar *name
,GError **error
);
Get the configuration value of name
as string.
Parameters
config |
a GgitConfig. |
|
name |
the name of the configuration value. |
|
error |
a GError for error reporting, or |
ggit_config_set_string ()
gboolean ggit_config_set_string (GgitConfig *config
,const gchar *name
,const gchar *value
,GError **error
);
Set a new string value of a configuration.
Parameters
config |
a GgitConfig. |
|
name |
the name of the configuration value. |
|
value |
the new value. |
|
error |
a GError for error reporting, or |
ggit_config_delete_entry ()
gboolean ggit_config_delete_entry (GgitConfig *config
,const gchar *name
,GError **error
);
Delete a config variable from the config file.
Parameters
config |
a GgitConfig. |
|
name |
the configuration value. |
|
error |
a GError for error reporting, or |
ggit_config_foreach ()
gboolean ggit_config_foreach (GgitConfig *config
,GgitConfigCallback callback
,gpointer user_data
,GError **error
);
Call callback
for each configuration value.
Parameters
config |
a GgitConfig. |
|
callback |
[scope call] | |
user_data |
the user data for |
[allow-none] |
error |
a GError for error reporting, or |
ggit_config_match ()
gchar * ggit_config_match (GgitConfig *config
,GRegex *regex
,GMatchInfo **match_info
,GError **error
);
Matches a configuration against a regular expression. match_info
will
contain the match information if the return value is not NULL
, otherwise
error
will be set.
Parameters
config |
a GgitConfig. |
|
regex |
a GRegex. |
|
match_info |
a GMatchInfo. |
[out][allow-none] |
error |
a GError for error reporting, or |
ggit_config_match_foreach ()
gboolean ggit_config_match_foreach (GgitConfig *config
,GRegex *regex
,GgitConfigMatchCallback callback
,gpointer user_data
,GError **error
);
Call callback
for all configurations matching regex
.
Parameters
config |
a GgitConfig. |
|
regex |
a GRegex. |
|
callback |
[scope call][closure user_data] | |
user_data |
the user data for |
[closure] |
error |
a GError for error reporting, or |
Types and Values
enum GgitConfigLevel
Priority level of a config file. These priority levels correspond to the natural escalation logic (from higher to lower) when searching for config entries in git.git.
Members
System-wide on Windows, for compatibility with portable git. |
||
System-wide configuration file. |
||
XDG compatible configuration file (.config/git/config). |
||
User-specific configuration file, also called Global configuration file. |
||
Repository specific configuration file. |
||
Application specific configuration file; freely defined by applications. |
||
Represents the highest level of a config file. |