git_config_get_mapped

Query the value of a config variable and return it mapped to an integer constant.

This is a helper method to easily map different possible values to a variable to integer constants that easily identify them.

A mapping array looks as follows:

git_configmap[] autocrlf_mapping = { {GIT_CVAR_FALSE, null, GIT_AUTO_CRLF_FALSE}, {GIT_CVAR_TRUE, null, GIT_AUTO_CRLF_TRUE}, {GIT_CVAR_STRING, "input", GIT_AUTO_CRLF_INPUT}, {GIT_CVAR_STRING, "default", GIT_AUTO_CRLF_DEFAULT}};

On any "false" value for the variable (e.g. "false", "FALSE", "no"), the mapping will store GIT_AUTO_CRLF_FALSE in the out parameter.

The same thing applies for any "true" value such as "true", "yes" or "1", storing the GIT_AUTO_CRLF_TRUE variable.

Otherwise, if the value matches the string "input" (with case insensitive comparison), the given constant will be stored in out, and likewise for "default".

If not a single match can be made to store in out, an error code will be returned.

extern (C) nothrow @nogc
int
git_config_get_mapped
(
int* out_
,,
const(char)* name
,,
size_t map_n
)

Parameters

out_ int*

place to store the result of the mapping

cfg const(libgit2_d.types.git_config)*

config file to get the variables from

name const(char)*

name of the config variable to lookup

maps const(.git_configmap)*

array of git_configmap objects specifying the possible mappings

map_n size_t

number of mapping objects in maps

Return Value

Type: int

0 on success, error code otherwise

Meta