]> git.proxmox.com Git - libgit2.git/blobdiff - src/config_cache.c
Update d/ch for 0.28.4+dfsg.1-4 release
[libgit2.git] / src / config_cache.c
index 45c39ce17958f82b7572226215e55186b7e34c4b..2530217c92633a8c0d46f77cd070395863ee1266 100644 (file)
@@ -6,6 +6,7 @@
  */
 
 #include "common.h"
+
 #include "fileops.h"
 #include "repository.h"
 #include "config.h"
@@ -57,6 +58,12 @@ static git_cvar_map _cvar_map_safecrlf[] = {
        {GIT_CVAR_STRING, "warn", GIT_SAFE_CRLF_WARN}
 };
 
+static git_cvar_map _cvar_map_logallrefupdates[] = {
+       {GIT_CVAR_FALSE, NULL, GIT_LOGALLREFUPDATES_FALSE},
+       {GIT_CVAR_TRUE, NULL, GIT_LOGALLREFUPDATES_TRUE},
+       {GIT_CVAR_STRING, "always", GIT_LOGALLREFUPDATES_ALWAYS},
+};
+
 /*
  * Generic map for integer values
  */
@@ -75,16 +82,20 @@ static struct map_data _cvar_maps[] = {
        {"core.abbrev", _cvar_map_int, 1, GIT_ABBREV_DEFAULT },
        {"core.precomposeunicode", NULL, 0, GIT_PRECOMPOSE_DEFAULT },
        {"core.safecrlf", _cvar_map_safecrlf, ARRAY_SIZE(_cvar_map_safecrlf), GIT_SAFE_CRLF_DEFAULT},
-       {"core.logallrefupdates", NULL, 0, GIT_LOGALLREFUPDATES_DEFAULT },
+       {"core.logallrefupdates", _cvar_map_logallrefupdates, ARRAY_SIZE(_cvar_map_logallrefupdates), GIT_LOGALLREFUPDATES_DEFAULT},
+       {"core.protecthfs", NULL, 0, GIT_PROTECTHFS_DEFAULT },
+       {"core.protectntfs", NULL, 0, GIT_PROTECTNTFS_DEFAULT },
+       {"core.fsyncobjectfiles", NULL, 0, GIT_FSYNCOBJECTFILES_DEFAULT },
 };
 
 int git_config__cvar(int *out, git_config *config, git_cvar_cached cvar)
 {
        int error = 0;
        struct map_data *data = &_cvar_maps[(int)cvar];
-       const git_config_entry *entry;
+       git_config_entry *entry;
 
-       git_config__lookup_entry(&entry, config, data->cvar_name, false);
+       if ((error = git_config__lookup_entry(&entry, config, data->cvar_name, false)) < 0)
+               return error;
 
        if (!entry)
                *out = data->default_value;
@@ -94,6 +105,7 @@ int git_config__cvar(int *out, git_config *config, git_cvar_cached cvar)
        else
                error = git_config_parse_bool(out, entry->value);
 
+       git_config_entry_free(entry);
        return error;
 }