Commit dadbb33b by Sven Strickroth

Fix crash if snapshotting a config_snapshot

Signed-off-by: Sven Strickroth <email@cs-ware.de>
parent 257dd59d
...@@ -192,6 +192,7 @@ int git_config_backend_snapshot(git_config_backend **out, git_config_backend *so ...@@ -192,6 +192,7 @@ int git_config_backend_snapshot(git_config_backend **out, git_config_backend *so
backend->parent.get = config_get_readonly; backend->parent.get = config_get_readonly;
backend->parent.set = config_set_readonly; backend->parent.set = config_set_readonly;
backend->parent.set_multivar = config_set_multivar_readonly; backend->parent.set_multivar = config_set_multivar_readonly;
backend->parent.snapshot = git_config_backend_snapshot;
backend->parent.del = config_delete_readonly; backend->parent.del = config_delete_readonly;
backend->parent.del_multivar = config_delete_multivar_readonly; backend->parent.del_multivar = config_delete_multivar_readonly;
backend->parent.iterator = config_iterator_new_readonly; backend->parent.iterator = config_iterator_new_readonly;
......
...@@ -100,3 +100,23 @@ void test_config_snapshot__includes(void) ...@@ -100,3 +100,23 @@ void test_config_snapshot__includes(void)
cl_git_pass(p_unlink("including")); cl_git_pass(p_unlink("including"));
cl_git_pass(p_unlink("included")); cl_git_pass(p_unlink("included"));
} }
void test_config_snapshot__snapshot(void)
{
git_config *snapshot_snapshot;
int i;
cl_git_mkfile("configfile", "[section]\nkey = 1\n");
cl_git_pass(git_config_open_ondisk(&cfg, "configfile"));
cl_git_pass(git_config_snapshot(&snapshot, cfg));
cl_git_pass(git_config_snapshot(&snapshot_snapshot, snapshot));
cl_git_pass(git_config_get_int32(&i, snapshot_snapshot, "section.key"));
cl_assert_equal_i(i, 1);
git_config_free(snapshot_snapshot);
cl_git_pass(p_unlink("configfile"));
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment