summaryrefslogtreecommitdiff
path: root/src/pack-objects.c
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2014-03-15 03:53:36 +0100
committerCarlos Martín Nieto <cmn@dwim.me>2014-04-18 16:03:01 +0200
commit29c4cb0965b67ad1ae7f640dfee67cf3ce358c26 (patch)
tree6aaaea724b43049fdc045ae1ea6c043f44e34c0d /src/pack-objects.c
parent55ebd7d369a789f27fe1ad6b8ec8965aa1335d08 (diff)
downloadlibgit2-29c4cb0965b67ad1ae7f640dfee67cf3ce358c26.tar.gz
Use config snapshotting
This way we can assume we have a consistent view of the config situation when we're looking up remote, branch, pack-objects, etc.
Diffstat (limited to 'src/pack-objects.c')
-rw-r--r--src/pack-objects.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/pack-objects.c b/src/pack-objects.c
index c881e6d99..e7c7f391f 100644
--- a/src/pack-objects.c
+++ b/src/pack-objects.c
@@ -86,12 +86,15 @@ static unsigned name_hash(const char *name)
static int packbuilder_config(git_packbuilder *pb)
{
- git_config *config;
+ git_config *config, *repo_config;
int ret;
int64_t val;
- if (git_repository_config__weakptr(&config, pb->repo) < 0)
- return -1;
+ if ((ret = git_repository_config__weakptr(&repo_config, pb->repo)) < 0)
+ return ret;
+
+ if ((ret = git_config_snapshot(&config, repo_config)) < 0)
+ return ret;
#define config_get(KEY,DST,DFLT) do { \
ret = git_config_get_int64(&val, config, KEY); \
@@ -109,6 +112,8 @@ static int packbuilder_config(git_packbuilder *pb)
#undef config_get
+ git_config_free(config);
+
return 0;
}