config: pass repository when opening config files Our current configuration logic is completely oblivious of any repository, but only cares for actual file paths. Unfortunately, we are forced to break this assumption by the introduction of conditional includes, which are evaluated in the context of a repository. Right now, only one conditional exists with "gitdir:" -- it will only include the configuration if the current repository's git directory matches the value passed to "gitdir:". To support these conditionals, we have to break our API and make the repository available when opening a configuration file. This commit extends the `open` call of configuration backends to include another repository and adjusts existing code to have it available. This includes the user-visible functions `git_config_add_file_ondisk` and `git_config_add_backend`.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528
diff --git a/include/git2/config.h b/include/git2/config.h
index d0f1ba1..d812e16 100644
--- a/include/git2/config.h
+++ b/include/git2/config.h
@@ -199,6 +199,8 @@ GIT_EXTERN(int) git_config_new(git_config **out);
* @param path path to the configuration file to add
* @param level the priority level of the backend
* @param force replace config file at the given priority level
+ * @param repo optional repository to allow parsing of
+ * conditional includes
* @return 0 on success, GIT_EEXISTS when adding more than one file
* for a given priority level (and force_replace set to 0),
* GIT_ENOTFOUND when the file doesn't exist or error code
@@ -207,6 +209,7 @@ GIT_EXTERN(int) git_config_add_file_ondisk(
git_config *cfg,
const char *path,
git_config_level_t level,
+ const git_repository *repo,
int force);
/**
diff --git a/include/git2/sys/config.h b/include/git2/sys/config.h
index 4dad6da..ed20322 100644
--- a/include/git2/sys/config.h
+++ b/include/git2/sys/config.h
@@ -58,7 +58,7 @@ struct git_config_backend {
struct git_config *cfg;
/* Open means open the file/database and parse if necessary */
- int (*open)(struct git_config_backend *, git_config_level_t level);
+ int (*open)(struct git_config_backend *, git_config_level_t level, const git_repository *repo);
int (*get)(struct git_config_backend *, const char *key, git_config_entry **entry);
int (*set)(struct git_config_backend *, const char *key, const char *value);
int (*set_multivar)(git_config_backend *cfg, const char *name, const char *regexp, const char *value);
@@ -111,6 +111,8 @@ GIT_EXTERN(int) git_config_init_backend(
* @param cfg the configuration to add the file to
* @param file the configuration file (backend) to add
* @param level the priority level of the backend
+ * @param repo optional repository to allow parsing of
+ * conditional includes
* @param force if a config file already exists for the given
* priority level, replace it
* @return 0 on success, GIT_EEXISTS when adding more than one file
@@ -120,6 +122,7 @@ GIT_EXTERN(int) git_config_add_backend(
git_config *cfg,
git_config_backend *file,
git_config_level_t level,
+ const git_repository *repo,
int force);
/** @} */
diff --git a/src/config.c b/src/config.c
index 602e0e8..1bc11b9 100644
--- a/src/config.c
+++ b/src/config.c
@@ -99,6 +99,7 @@ int git_config_add_file_ondisk(
git_config *cfg,
const char *path,
git_config_level_t level,
+ const git_repository *repo,
int force)
{
git_config_backend *file = NULL;
@@ -116,7 +117,7 @@ int git_config_add_file_ondisk(
if (git_config_file__ondisk(&file, path) < 0)
return -1;
- if ((res = git_config_add_backend(cfg, file, level, force)) < 0) {
+ if ((res = git_config_add_backend(cfg, file, level, repo, force)) < 0) {
/*
* free manually; the file is not owned by the config
* instance yet and will not be freed on cleanup
@@ -138,7 +139,7 @@ int git_config_open_ondisk(git_config **out, const char *path)
if (git_config_new(&config) < 0)
return -1;
- if ((error = git_config_add_file_ondisk(config, path, GIT_CONFIG_LEVEL_LOCAL, 0)) < 0)
+ if ((error = git_config_add_file_ondisk(config, path, GIT_CONFIG_LEVEL_LOCAL, NULL, 0)) < 0)
git_config_free(config);
else
*out = config;
@@ -164,7 +165,7 @@ int git_config_snapshot(git_config **out, git_config *in)
if ((error = internal->file->snapshot(&b, internal->file)) < 0)
break;
- if ((error = git_config_add_backend(config, b, internal->level, 0)) < 0) {
+ if ((error = git_config_add_backend(config, b, internal->level, NULL, 0)) < 0) {
b->free(b);
break;
}
@@ -307,6 +308,7 @@ int git_config_add_backend(
git_config *cfg,
git_config_backend *file,
git_config_level_t level,
+ const git_repository *repo,
int force)
{
file_internal *internal;
@@ -316,7 +318,7 @@ int git_config_add_backend(
GITERR_CHECK_VERSION(file, GIT_CONFIG_BACKEND_VERSION, "git_config_backend");
- if ((result = file->open(file, level)) < 0)
+ if ((result = file->open(file, level, repo)) < 0)
return result;
internal = git__malloc(sizeof(file_internal));
@@ -1147,20 +1149,20 @@ int git_config_open_default(git_config **out)
if (!git_config_find_global(&buf) || !git_config__global_location(&buf)) {
error = git_config_add_file_ondisk(cfg, buf.ptr,
- GIT_CONFIG_LEVEL_GLOBAL, 0);
+ GIT_CONFIG_LEVEL_GLOBAL, NULL, 0);
}
if (!error && !git_config_find_xdg(&buf))
error = git_config_add_file_ondisk(cfg, buf.ptr,
- GIT_CONFIG_LEVEL_XDG, 0);
+ GIT_CONFIG_LEVEL_XDG, NULL, 0);
if (!error && !git_config_find_system(&buf))
error = git_config_add_file_ondisk(cfg, buf.ptr,
- GIT_CONFIG_LEVEL_SYSTEM, 0);
+ GIT_CONFIG_LEVEL_SYSTEM, NULL, 0);
if (!error && !git_config_find_programdata(&buf))
error = git_config_add_file_ondisk(cfg, buf.ptr,
- GIT_CONFIG_LEVEL_PROGRAMDATA, 0);
+ GIT_CONFIG_LEVEL_PROGRAMDATA, NULL, 0);
git_buf_free(&buf);
diff --git a/src/config_file.c b/src/config_file.c
index 00d6d9e..4146bd8 100644
--- a/src/config_file.c
+++ b/src/config_file.c
@@ -105,6 +105,7 @@ typedef struct {
diskfile_header header;
git_config_level_t level;
+ const git_repository *repo;
bool locked;
git_filebuf locked_buf;
@@ -281,12 +282,13 @@ static void config_file_clear(struct config_file *file)
git__free(file->path);
}
-static int config_open(git_config_backend *cfg, git_config_level_t level)
+static int config_open(git_config_backend *cfg, git_config_level_t level, const git_repository *repo)
{
int res;
diskfile_backend *b = (diskfile_backend *)cfg;
b->level = level;
+ b->repo = repo;
if ((res = refcounted_strmap_alloc(&b->header.values)) < 0)
return res;
@@ -439,7 +441,7 @@ static int config_iterator_new(
if ((error = config_snapshot(&snapshot, backend)) < 0)
return error;
- if ((error = snapshot->open(snapshot, b->level)) < 0)
+ if ((error = snapshot->open(snapshot, b->level, b->repo)) < 0)
return error;
it = git__calloc(1, sizeof(git_config_file_iter));
@@ -831,7 +833,7 @@ static void backend_readonly_free(git_config_backend *_backend)
git__free(backend);
}
-static int config_readonly_open(git_config_backend *cfg, git_config_level_t level)
+static int config_readonly_open(git_config_backend *cfg, git_config_level_t level, const git_repository *repo)
{
diskfile_readonly_backend *b = (diskfile_readonly_backend *) cfg;
diskfile_backend *src = b->snapshot_from;
@@ -842,8 +844,9 @@ static int config_readonly_open(git_config_backend *cfg, git_config_level_t leve
if (!src_header->parent.readonly && (error = config_refresh(&src_header->parent)) < 0)
return error;
- /* We're just copying data, don't care about the level */
+ /* We're just copying data, don't care about the level or repo*/
GIT_UNUSED(level);
+ GIT_UNUSED(repo);
if ((src_map = refcounted_strmap_take(src_header)) == NULL)
return -1;
diff --git a/src/config_file.h b/src/config_file.h
index 11b8118..25ef45e 100644
--- a/src/config_file.h
+++ b/src/config_file.h
@@ -12,9 +12,9 @@
#include "git2/sys/config.h"
#include "git2/config.h"
-GIT_INLINE(int) git_config_file_open(git_config_backend *cfg, unsigned int level)
+GIT_INLINE(int) git_config_file_open(git_config_backend *cfg, unsigned int level, const git_repository *repo)
{
- return cfg->open(cfg, level);
+ return cfg->open(cfg, level, repo);
}
GIT_INLINE(void) git_config_file_free(git_config_backend *cfg)
diff --git a/src/repository.c b/src/repository.c
index d128b84..fe06963 100644
--- a/src/repository.c
+++ b/src/repository.c
@@ -946,7 +946,7 @@ static int load_config(
return error;
if ((error = git_repository_item_path(&config_path, repo, GIT_REPOSITORY_ITEM_CONFIG)) == 0)
- error = git_config_add_file_ondisk(cfg, config_path.ptr, GIT_CONFIG_LEVEL_LOCAL, 0);
+ error = git_config_add_file_ondisk(cfg, config_path.ptr, GIT_CONFIG_LEVEL_LOCAL, repo, 0);
if (error && error != GIT_ENOTFOUND)
goto on_error;
@@ -955,25 +955,25 @@ static int load_config(
if (global_config_path != NULL &&
(error = git_config_add_file_ondisk(
- cfg, global_config_path, GIT_CONFIG_LEVEL_GLOBAL, 0)) < 0 &&
+ cfg, global_config_path, GIT_CONFIG_LEVEL_GLOBAL, repo, 0)) < 0 &&
error != GIT_ENOTFOUND)
goto on_error;
if (xdg_config_path != NULL &&
(error = git_config_add_file_ondisk(
- cfg, xdg_config_path, GIT_CONFIG_LEVEL_XDG, 0)) < 0 &&
+ cfg, xdg_config_path, GIT_CONFIG_LEVEL_XDG, repo, 0)) < 0 &&
error != GIT_ENOTFOUND)
goto on_error;
if (system_config_path != NULL &&
(error = git_config_add_file_ondisk(
- cfg, system_config_path, GIT_CONFIG_LEVEL_SYSTEM, 0)) < 0 &&
+ cfg, system_config_path, GIT_CONFIG_LEVEL_SYSTEM, repo, 0)) < 0 &&
error != GIT_ENOTFOUND)
goto on_error;
if (programdata_path != NULL &&
(error = git_config_add_file_ondisk(
- cfg, programdata_path, GIT_CONFIG_LEVEL_PROGRAMDATA, 0)) < 0 &&
+ cfg, programdata_path, GIT_CONFIG_LEVEL_PROGRAMDATA, repo, 0)) < 0 &&
error != GIT_ENOTFOUND)
goto on_error;
@@ -1475,7 +1475,7 @@ static int repo_local_config(
giterr_clear();
if (!(error = git_config_add_file_ondisk(
- parent, cfg_path, GIT_CONFIG_LEVEL_LOCAL, false)))
+ parent, cfg_path, GIT_CONFIG_LEVEL_LOCAL, repo, false)))
error = git_config_open_level(out, parent, GIT_CONFIG_LEVEL_LOCAL);
}
diff --git a/src/submodule.c b/src/submodule.c
index 6c3e5f6..3ec0307 100644
--- a/src/submodule.c
+++ b/src/submodule.c
@@ -1960,7 +1960,7 @@ static git_config_backend *open_gitmodules(
if (git_config_file__ondisk(&mods, path.ptr) < 0)
mods = NULL;
/* open should only fail here if the file is malformed */
- else if (git_config_file_open(mods, GIT_CONFIG_LEVEL_LOCAL) < 0) {
+ else if (git_config_file_open(mods, GIT_CONFIG_LEVEL_LOCAL, repo) < 0) {
git_config_file_free(mods);
mods = NULL;
}
diff --git a/tests/config/backend.c b/tests/config/backend.c
index 3fd6eb1..18c4ca5 100644
--- a/tests/config/backend.c
+++ b/tests/config/backend.c
@@ -10,13 +10,13 @@ void test_config_backend__checks_version(void)
backend.version = 1024;
cl_git_pass(git_config_new(&cfg));
- cl_git_fail(git_config_add_backend(cfg, &backend, 0, false));
+ cl_git_fail(git_config_add_backend(cfg, &backend, 0, NULL, false));
err = giterr_last();
cl_assert_equal_i(GITERR_INVALID, err->klass);
giterr_clear();
backend.version = 1024;
- cl_git_fail(git_config_add_backend(cfg, &backend, 0, false));
+ cl_git_fail(git_config_add_backend(cfg, &backend, 0, NULL, false));
err = giterr_last();
cl_assert_equal_i(GITERR_INVALID, err->klass);
diff --git a/tests/config/configlevel.c b/tests/config/configlevel.c
index ca478b1..b73656c 100644
--- a/tests/config/configlevel.c
+++ b/tests/config/configlevel.c
@@ -7,11 +7,11 @@ void test_config_configlevel__adding_the_same_level_twice_returns_EEXISTS(void)
cl_git_pass(git_config_new(&cfg));
cl_git_pass(git_config_add_file_ondisk(cfg, cl_fixture("config/config9"),
- GIT_CONFIG_LEVEL_LOCAL, 0));
+ GIT_CONFIG_LEVEL_LOCAL, NULL, 0));
cl_git_pass(git_config_add_file_ondisk(cfg, cl_fixture("config/config15"),
- GIT_CONFIG_LEVEL_GLOBAL, 0));
+ GIT_CONFIG_LEVEL_GLOBAL, NULL, 0));
error = git_config_add_file_ondisk(cfg, cl_fixture("config/config16"),
- GIT_CONFIG_LEVEL_GLOBAL, 0);
+ GIT_CONFIG_LEVEL_GLOBAL, NULL, 0);
cl_git_fail(error);
cl_assert_equal_i(GIT_EEXISTS, error);
@@ -26,9 +26,9 @@ void test_config_configlevel__can_replace_a_config_file_at_an_existing_level(voi
cl_git_pass(git_config_new(&cfg));
cl_git_pass(git_config_add_file_ondisk(cfg, cl_fixture("config/config18"),
- GIT_CONFIG_LEVEL_LOCAL, 1));
+ GIT_CONFIG_LEVEL_LOCAL, NULL, 1));
cl_git_pass(git_config_add_file_ondisk(cfg, cl_fixture("config/config19"),
- GIT_CONFIG_LEVEL_LOCAL, 1));
+ GIT_CONFIG_LEVEL_LOCAL, NULL, 1));
cl_git_pass(git_config_get_string_buf(&buf, cfg, "core.stringglobal"));
cl_assert_equal_s("don't find me!", buf.ptr);
@@ -45,9 +45,9 @@ void test_config_configlevel__can_read_from_a_single_level_focused_file_after_pa
cl_git_pass(git_config_new(&cfg));
cl_git_pass(git_config_add_file_ondisk(cfg, cl_fixture("config/config18"),
- GIT_CONFIG_LEVEL_GLOBAL, 0));
+ GIT_CONFIG_LEVEL_GLOBAL, NULL, 0));
cl_git_pass(git_config_add_file_ondisk(cfg, cl_fixture("config/config19"),
- GIT_CONFIG_LEVEL_LOCAL, 0));
+ GIT_CONFIG_LEVEL_LOCAL, NULL, 0));
cl_git_pass(git_config_open_level(&single_level_cfg, cfg, GIT_CONFIG_LEVEL_LOCAL));
diff --git a/tests/config/multivar.c b/tests/config/multivar.c
index d1b8c4c..4f08a48 100644
--- a/tests/config/multivar.c
+++ b/tests/config/multivar.c
@@ -94,27 +94,27 @@ void test_config_multivar__get(void)
check_get_multivar_foreach(cfg, 2, 1);
/* add another that has the _name entry */
- cl_git_pass(git_config_add_file_ondisk(cfg, "config/config9", GIT_CONFIG_LEVEL_SYSTEM, 1));
+ cl_git_pass(git_config_add_file_ondisk(cfg, "config/config9", GIT_CONFIG_LEVEL_SYSTEM, NULL, 1));
check_get_multivar_foreach(cfg, 3, 2);
/* add another that does not have the _name entry */
- cl_git_pass(git_config_add_file_ondisk(cfg, "config/config0", GIT_CONFIG_LEVEL_GLOBAL, 1));
+ cl_git_pass(git_config_add_file_ondisk(cfg, "config/config0", GIT_CONFIG_LEVEL_GLOBAL, NULL, 1));
check_get_multivar_foreach(cfg, 3, 2);
/* add another that does not have the _name entry at the end */
- cl_git_pass(git_config_add_file_ondisk(cfg, "config/config1", GIT_CONFIG_LEVEL_APP, 1));
+ cl_git_pass(git_config_add_file_ondisk(cfg, "config/config1", GIT_CONFIG_LEVEL_APP, NULL, 1));
check_get_multivar_foreach(cfg, 3, 2);
/* drop original file */
- cl_git_pass(git_config_add_file_ondisk(cfg, "config/config2", GIT_CONFIG_LEVEL_LOCAL, 1));
+ cl_git_pass(git_config_add_file_ondisk(cfg, "config/config2", GIT_CONFIG_LEVEL_LOCAL, NULL, 1));
check_get_multivar_foreach(cfg, 1, 1);
/* drop other file with match */
- cl_git_pass(git_config_add_file_ondisk(cfg, "config/config3", GIT_CONFIG_LEVEL_SYSTEM, 1));
+ cl_git_pass(git_config_add_file_ondisk(cfg, "config/config3", GIT_CONFIG_LEVEL_SYSTEM, NULL, 1));
check_get_multivar_foreach(cfg, 0, 0);
/* reload original file (add different place in order) */
- cl_git_pass(git_config_add_file_ondisk(cfg, "config/config11", GIT_CONFIG_LEVEL_SYSTEM, 1));
+ cl_git_pass(git_config_add_file_ondisk(cfg, "config/config11", GIT_CONFIG_LEVEL_SYSTEM, NULL, 1));
check_get_multivar_foreach(cfg, 2, 1);
check_get_multivar(cfg, 2);
diff --git a/tests/config/read.c b/tests/config/read.c
index f86b2d7..25a4fca 100644
--- a/tests/config/read.c
+++ b/tests/config/read.c
@@ -289,9 +289,9 @@ void test_config_read__foreach(void)
cl_git_pass(git_config_new(&cfg));
cl_git_pass(git_config_add_file_ondisk(cfg, cl_fixture("config/config9"),
- GIT_CONFIG_LEVEL_SYSTEM, 0));
+ GIT_CONFIG_LEVEL_SYSTEM, NULL, 0));
cl_git_pass(git_config_add_file_ondisk(cfg, cl_fixture("config/config15"),
- GIT_CONFIG_LEVEL_GLOBAL, 0));
+ GIT_CONFIG_LEVEL_GLOBAL, NULL, 0));
count = 0;
cl_git_pass(git_config_foreach(cfg, count_cfg_entries_and_compare_levels, &count));
@@ -313,9 +313,9 @@ void test_config_read__iterator(void)
cl_git_pass(git_config_new(&cfg));
cl_git_pass(git_config_add_file_ondisk(cfg, cl_fixture("config/config9"),
- GIT_CONFIG_LEVEL_SYSTEM, 0));
+ GIT_CONFIG_LEVEL_SYSTEM, NULL, 0));
cl_git_pass(git_config_add_file_ondisk(cfg, cl_fixture("config/config15"),
- GIT_CONFIG_LEVEL_GLOBAL, 0));
+ GIT_CONFIG_LEVEL_GLOBAL, NULL, 0));
count = 0;
cl_git_pass(git_config_iterator_new(&iter, cfg));
@@ -445,7 +445,7 @@ void test_config_read__read_git_config_entry(void)
cl_git_pass(git_config_new(&cfg));
cl_git_pass(git_config_add_file_ondisk(cfg, cl_fixture("config/config9"),
- GIT_CONFIG_LEVEL_SYSTEM, 0));
+ GIT_CONFIG_LEVEL_SYSTEM, NULL, 0));
cl_git_pass(git_config_get_entry(&entry, cfg, "core.dummy2"));
cl_assert_equal_s("core.dummy2", entry->name);
@@ -469,11 +469,11 @@ void test_config_read__local_config_overrides_global_config_overrides_system_con
cl_git_pass(git_config_new(&cfg));
cl_git_pass(git_config_add_file_ondisk(cfg, cl_fixture("config/config9"),
- GIT_CONFIG_LEVEL_SYSTEM, 0));
+ GIT_CONFIG_LEVEL_SYSTEM, NULL, 0));
cl_git_pass(git_config_add_file_ondisk(cfg, cl_fixture("config/config15"),
- GIT_CONFIG_LEVEL_GLOBAL, 0));
+ GIT_CONFIG_LEVEL_GLOBAL, NULL, 0));
cl_git_pass(git_config_add_file_ondisk(cfg, cl_fixture("config/config16"),
- GIT_CONFIG_LEVEL_LOCAL, 0));
+ GIT_CONFIG_LEVEL_LOCAL, NULL, 0));
cl_git_pass(git_config_get_int32(&i, cfg, "core.dummy2"));
cl_assert_equal_i(28, i);
@@ -482,9 +482,9 @@ void test_config_read__local_config_overrides_global_config_overrides_system_con
cl_git_pass(git_config_new(&cfg));
cl_git_pass(git_config_add_file_ondisk(cfg, cl_fixture("config/config9"),
- GIT_CONFIG_LEVEL_SYSTEM, 0));
+ GIT_CONFIG_LEVEL_SYSTEM, NULL, 0));
cl_git_pass(git_config_add_file_ondisk(cfg, cl_fixture("config/config15"),
- GIT_CONFIG_LEVEL_GLOBAL, 0));
+ GIT_CONFIG_LEVEL_GLOBAL, NULL, 0));
cl_git_pass(git_config_get_int32(&i, cfg, "core.dummy2"));
cl_assert_equal_i(7, i);
@@ -510,11 +510,11 @@ void test_config_read__fallback_from_local_to_global_and_from_global_to_system(v
cl_git_pass(git_config_new(&cfg));
cl_git_pass(git_config_add_file_ondisk(cfg, cl_fixture("config/config9"),
- GIT_CONFIG_LEVEL_SYSTEM, 0));
+ GIT_CONFIG_LEVEL_SYSTEM, NULL, 0));
cl_git_pass(git_config_add_file_ondisk(cfg, cl_fixture("config/config15"),
- GIT_CONFIG_LEVEL_GLOBAL, 0));
+ GIT_CONFIG_LEVEL_GLOBAL, NULL, 0));
cl_git_pass(git_config_add_file_ondisk(cfg, cl_fixture("config/config16"),
- GIT_CONFIG_LEVEL_LOCAL, 0));
+ GIT_CONFIG_LEVEL_LOCAL, NULL, 0));
cl_git_pass(git_config_get_int32(&i, cfg, "core.global"));
cl_assert_equal_i(17, i);
@@ -546,9 +546,9 @@ void test_config_read__simple_read_from_specific_level(void)
cl_git_pass(git_config_new(&cfg));
cl_git_pass(git_config_add_file_ondisk(cfg, cl_fixture("config/config18"),
- GIT_CONFIG_LEVEL_GLOBAL, 0));
+ GIT_CONFIG_LEVEL_GLOBAL, NULL, 0));
cl_git_pass(git_config_add_file_ondisk(cfg, cl_fixture("config/config19"),
- GIT_CONFIG_LEVEL_SYSTEM, 0));
+ GIT_CONFIG_LEVEL_SYSTEM, NULL, 0));
cl_git_pass(git_config_open_level(&cfg_specific, cfg, GIT_CONFIG_LEVEL_GLOBAL));
diff --git a/tests/config/readonly.c b/tests/config/readonly.c
index 6d6819e..a424922 100644
--- a/tests/config/readonly.c
+++ b/tests/config/readonly.c
@@ -22,7 +22,7 @@ void test_config_readonly__writing_to_readonly_fails(void)
cl_git_pass(git_config_file__ondisk(&backend, "global"));
backend->readonly = 1;
- cl_git_pass(git_config_add_backend(cfg, backend, GIT_CONFIG_LEVEL_GLOBAL, 0));
+ cl_git_pass(git_config_add_backend(cfg, backend, GIT_CONFIG_LEVEL_GLOBAL, NULL, 0));
cl_git_fail_with(GIT_ENOTFOUND, git_config_set_string(cfg, "foo.bar", "baz"));
cl_assert(!git_path_exists("global"));
@@ -34,10 +34,10 @@ void test_config_readonly__writing_to_cfg_with_rw_precedence_succeeds(void)
cl_git_pass(git_config_file__ondisk(&backend, "global"));
backend->readonly = 1;
- cl_git_pass(git_config_add_backend(cfg, backend, GIT_CONFIG_LEVEL_GLOBAL, 0));
+ cl_git_pass(git_config_add_backend(cfg, backend, GIT_CONFIG_LEVEL_GLOBAL, NULL, 0));
cl_git_pass(git_config_file__ondisk(&backend, "local"));
- cl_git_pass(git_config_add_backend(cfg, backend, GIT_CONFIG_LEVEL_LOCAL, 0));
+ cl_git_pass(git_config_add_backend(cfg, backend, GIT_CONFIG_LEVEL_LOCAL, NULL, 0));
cl_git_pass(git_config_set_string(cfg, "foo.bar", "baz"));
@@ -52,10 +52,10 @@ void test_config_readonly__writing_to_cfg_with_ro_precedence_succeeds(void)
cl_git_pass(git_config_file__ondisk(&backend, "local"));
backend->readonly = 1;
- cl_git_pass(git_config_add_backend(cfg, backend, GIT_CONFIG_LEVEL_LOCAL, 0));
+ cl_git_pass(git_config_add_backend(cfg, backend, GIT_CONFIG_LEVEL_LOCAL, NULL, 0));
cl_git_pass(git_config_file__ondisk(&backend, "global"));
- cl_git_pass(git_config_add_backend(cfg, backend, GIT_CONFIG_LEVEL_GLOBAL, 0));
+ cl_git_pass(git_config_add_backend(cfg, backend, GIT_CONFIG_LEVEL_GLOBAL, NULL, 0));
cl_git_pass(git_config_set_string(cfg, "foo.bar", "baz"));
diff --git a/tests/config/write.c b/tests/config/write.c
index 56ef2e9..44131cf 100644
--- a/tests/config/write.c
+++ b/tests/config/write.c
@@ -93,9 +93,9 @@ void test_config_write__delete_value_at_specific_level(void)
cl_git_pass(git_config_new(&cfg));
cl_git_pass(git_config_add_file_ondisk(cfg, "config9",
- GIT_CONFIG_LEVEL_LOCAL, 0));
+ GIT_CONFIG_LEVEL_LOCAL, NULL, 0));
cl_git_pass(git_config_add_file_ondisk(cfg, "config15",
- GIT_CONFIG_LEVEL_GLOBAL, 0));
+ GIT_CONFIG_LEVEL_GLOBAL, NULL, 0));
cl_git_pass(git_config_open_level(&cfg_specific, cfg, GIT_CONFIG_LEVEL_GLOBAL));
@@ -368,9 +368,9 @@ void test_config_write__add_value_at_specific_level(void)
// open config15 as global level config file
cl_git_pass(git_config_new(&cfg));
cl_git_pass(git_config_add_file_ondisk(cfg, "config9",
- GIT_CONFIG_LEVEL_LOCAL, 0));
+ GIT_CONFIG_LEVEL_LOCAL, NULL, 0));
cl_git_pass(git_config_add_file_ondisk(cfg, "config15",
- GIT_CONFIG_LEVEL_GLOBAL, 0));
+ GIT_CONFIG_LEVEL_GLOBAL, NULL, 0));
cl_git_pass(git_config_open_level(&cfg_specific, cfg, GIT_CONFIG_LEVEL_GLOBAL));