summaryrefslogtreecommitdiff
path: root/src/refdb_fs.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2014-05-13 16:32:27 -0700
committerRussell Belfer <rb@github.com>2014-05-13 16:32:27 -0700
commit2b52a0bfaedf7571e7ecd706947f5865d513760c (patch)
tree27faafab276a9023f5357b29f537972c4e385732 /src/refdb_fs.c
parenta37aa82ea6f952745c883065a86162343e438981 (diff)
downloadlibgit2-rb/coverity-fixes.tar.gz
Increase use of config snapshotsrb/coverity-fixes
And decrease extra reload checks of config data.
Diffstat (limited to 'src/refdb_fs.c')
-rw-r--r--src/refdb_fs.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/refdb_fs.c b/src/refdb_fs.c
index f9bd4eab5..dd8bf7916 100644
--- a/src/refdb_fs.c
+++ b/src/refdb_fs.c
@@ -927,19 +927,15 @@ static int has_reflog(git_repository *repo, const char *name);
/* We only write if it's under heads/, remotes/ or notes/ or if it already has a log */
static int should_write_reflog(int *write, git_repository *repo, const char *name)
{
- git_config *config;
- int error, logall, is_bare;
+ int error, logall;
- /* Defaults to the opposite of the repo being bare */
- is_bare = git_repository_is_bare(repo);
- logall = !is_bare;
-
- if ((error = git_repository_config__weakptr(&config, repo)) < 0)
+ error = git_repository__cvar(&logall, repo, GIT_CVAR_LOGALLREFUPDATES);
+ if (error < 0)
return error;
- error = git_config_get_bool(&logall, config, "core.logallrefupdates");
- if (error < 0 && error != GIT_ENOTFOUND)
- return error;
+ /* Defaults to the opposite of the repo being bare */
+ if (logall == GIT_LOGALLREFUPDATES_UNSET)
+ logall = !git_repository_is_bare(repo);
if (!logall) {
*write = 0;