diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2014-06-04 17:31:42 +0200 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2014-06-04 17:31:42 +0200 |
commit | 57cb1179e5c9c8f5c27c9115f13f1cae5d0f87a0 (patch) | |
tree | 67871086b1437dcd410979b423cd3ba140ab9257 /tests/repo/init.c | |
parent | 90befde4a1938641dfdb9a7bdb9f361d1de5c26f (diff) | |
download | libgit2-cmn/config-default-snapshot.tar.gz |
Make the default repository config getter return a snapshotcmn/config-default-snapshot
You should always use a snapshot, with the sole exception of writing to
the configuration.
Any reads that are not against a snapshot have race conditions, both in
terms of returned values as well as dangling pointers.
Diffstat (limited to 'tests/repo/init.c')
-rw-r--r-- | tests/repo/init.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/repo/init.c b/tests/repo/init.c index aea383c64..92c0ca986 100644 --- a/tests/repo/init.c +++ b/tests/repo/init.c @@ -138,7 +138,7 @@ void test_repo_init__reinit_too_recent_bare_repo(void) /* Initialize the repository */ cl_git_pass(git_repository_init(&_repo, "reinit.git", 1)); - git_repository_config(&config, _repo); + git_repository_config_writable(&config, _repo); /* * Hack the config of the repository to make it look like it has @@ -257,8 +257,8 @@ void test_repo_init__reinit_doesnot_overwrite_ignorecase(void) cl_git_pass(git_repository_init(&_repo, "not.overwrite.git", 1)); /* Change the "core.ignorecase" config value to something unlikely */ - git_repository_config(&config, _repo); - git_config_set_int32(config, "core.ignorecase", 42); + cl_git_pass(git_repository_config_writable(&config, _repo)); + cl_git_pass(git_config_set_int32(config, "core.ignorecase", 42)); git_config_free(config); git_repository_free(_repo); _repo = NULL; @@ -576,7 +576,7 @@ void test_repo_init__init_with_initial_commit(void) /* Make sure we're ready to use git_signature_default :-) */ { git_config *cfg, *local; - cl_git_pass(git_repository_config(&cfg, _repo)); + cl_git_pass(git_repository_config_writable(&cfg, _repo)); cl_git_pass(git_config_open_level(&local, cfg, GIT_CONFIG_LEVEL_LOCAL)); cl_git_pass(git_config_set_string(local, "user.name", "Test User")); cl_git_pass(git_config_set_string(local, "user.email", "t@example.com")); |