summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2018-02-28 11:33:11 +0100
committerCarlos Martín Nieto <cmn@dwim.me>2018-02-28 11:33:11 +0100
commitc1524b2e1c6acaa9c3de362bbc92935e997c409c (patch)
treec748ac83649002f3ed98d1b14ebe1593309f705b
parentc9d59c6140fc365eb7ab950fb1a33187a949d403 (diff)
downloadlibgit2-c1524b2e1c6acaa9c3de362bbc92935e997c409c.tar.gz
config: move the repository to the diskfile header
We pass this around and when creating a new iterator we need to read the repository pointer. Put it in a common place so we can reach it regardless of whether we got a full object or a snapshot.
-rw-r--r--src/config_file.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/config_file.c b/src/config_file.c
index 792a3de7a..4d1399933 100644
--- a/src/config_file.c
+++ b/src/config_file.c
@@ -86,13 +86,13 @@ typedef struct {
/* mutex to coordinate accessing the values */
git_mutex values_mutex;
refcounted_strmap *values;
+ const git_repository *repo;
} diskfile_header;
typedef struct {
diskfile_header header;
git_config_level_t level;
- const git_repository *repo;
git_array_t(git_config_parser) readers;
@@ -271,7 +271,7 @@ static int config_open(git_config_backend *cfg, git_config_level_t level, const
diskfile_backend *b = (diskfile_backend *)cfg;
b->level = level;
- b->repo = repo;
+ b->header.repo = repo;
if ((res = refcounted_strmap_alloc(&b->header.values)) < 0)
return res;
@@ -343,7 +343,7 @@ static int config_refresh(git_config_backend *cfg)
}
git_array_clear(b->file.includes);
- if ((error = config_read(values->values, b->repo, &b->file, b->level, 0)) < 0)
+ if ((error = config_read(values->values, b->header.repo, &b->file, b->level, 0)) < 0)
goto out;
if ((error = git_mutex_lock(&b->header.values_mutex)) < 0) {
@@ -423,7 +423,7 @@ static int config_iterator_new(
if ((error = config_snapshot(&snapshot, backend)) < 0)
return error;
- if ((error = snapshot->open(snapshot, b->level, b->repo)) < 0)
+ if ((error = snapshot->open(snapshot, b->level, b->header.repo)) < 0)
return error;
it = git__calloc(1, sizeof(git_config_file_iter));