diff options
author | Sven Strickroth <email@cs-ware.de> | 2019-11-01 18:55:54 +0100 |
---|---|---|
committer | Sven Strickroth <email@cs-ware.de> | 2019-11-01 20:04:20 +0100 |
commit | dadbb33b600969319fdc80898d0e4c9ebb16964d (patch) | |
tree | d2265fe21f2dcc24e4469ab725e6231198d8093e /tests/config | |
parent | 257dd59d031f169a55afb55d0c34527fac71c11e (diff) | |
download | libgit2-dadbb33b600969319fdc80898d0e4c9ebb16964d.tar.gz |
Fix crash if snapshotting a config_snapshot
Signed-off-by: Sven Strickroth <email@cs-ware.de>
Diffstat (limited to 'tests/config')
-rw-r--r-- | tests/config/snapshot.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/config/snapshot.c b/tests/config/snapshot.c index 61562d206..3b90cfe49 100644 --- a/tests/config/snapshot.c +++ b/tests/config/snapshot.c @@ -100,3 +100,23 @@ void test_config_snapshot__includes(void) cl_git_pass(p_unlink("including")); 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")); +} |