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_cvar_map autocrlf_mapping[3] = { {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.
place to store the result of the mapping
name of the config variable to lookup
number of mapping objects in maps
0 on success, error code otherwise