libgit2

git_repository_config

Version:

Retrieve the relevant configuration for a repository

By default he returned git_config instance contains a single configuration file, the `.gitconfig' file that may be found inside the repository.

If the user_config_path variable is not NULL, the given config file will be also included in the configuration set. On most UNIX systems, this file may be found on $HOME/.gitconfig.

If the system_config_path variable is not NULL, the given config file will be also included in the configuration set. On most UNIX systems, this file may be found on $PREFIX/etc/gitconfig.

The resulting git_config instance will query the files in the following order:

  • Repository configuration file
    • User configuration file
    • System configuration file

The method will fail if any of the passed config files cannot be found or accessed.

The returned git_config instance is owned by the caller and must be manually free'd once it's no longer on use.

Signature

int git_repository_config(git_config **out, git_repository *repo, const char *user_config_path, const char *system_config_path);

Parameters

In
out

the repository's configuration

In
repo

the repository for which to get the config

const char *
In
user_config_path

Path to the user config file

const char *
In
system_config_path

Path to the system-wide config file

Returns

int

Versions