*/
#include "common.h"
+
#include "fileops.h"
#include "repository.h"
#include "config.h"
{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
*/
{"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;
else
error = git_config_parse_bool(out, entry->value);
+ git_config_entry_free(entry);
return error;
}