diff options
| author | Carlos Martín Nieto <cmn@dwim.me> | 2014-10-23 18:58:39 +0200 |
|---|---|---|
| committer | Carlos Martín Nieto <cmn@dwim.me> | 2014-10-23 18:58:39 +0200 |
| commit | 4bb6ffb6bb8ad9d49eb173350be965183cd09c96 (patch) | |
| tree | 6e5a2d0cb8df338e5359c7342e845e31e9d9fa65 /tests/config | |
| parent | d676af43da6603f1b31fb6d2d3eb02793b260ad0 (diff) | |
| parent | ad5adacb1d1913620f022d7bb6c9b877ff3a4faf (diff) | |
| download | libgit2-4bb6ffb6bb8ad9d49eb173350be965183cd09c96.tar.gz | |
Merge pull request #2622 from libgit2/refresh-config-snapshot
Refresh git configuration before looking for the tracking branch redux.
Diffstat (limited to 'tests/config')
| -rw-r--r-- | tests/config/snapshot.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/config/snapshot.c b/tests/config/snapshot.c index c9f15921a..e47e252ac 100644 --- a/tests/config/snapshot.c +++ b/tests/config/snapshot.c @@ -3,7 +3,7 @@ void test_config_snapshot__create_snapshot(void) { int32_t tmp; - git_config *cfg, *snapshot; + git_config *cfg, *snapshot, *new_snapshot; const char *filename = "config-ext-change"; cl_git_mkfile(filename, "[old]\nvalue = 5\n"); @@ -23,6 +23,19 @@ void test_config_snapshot__create_snapshot(void) cl_git_pass(git_config_get_int32(&tmp, snapshot, "old.value")); cl_assert_equal_i(5, tmp); + + /* Change the value on the file itself (simulate external process) */ + cl_git_mkfile(filename, "[old]\nvalue = 999\n"); + + cl_git_pass(git_config_snapshot(&new_snapshot, cfg)); + + /* New snapshot should see new value */ + cl_git_pass(git_config_get_int32(&tmp, new_snapshot, "old.value")); + cl_assert_equal_i(999, tmp); + + /* Old snapshot should still have the old value */ + cl_git_pass(git_config_get_int32(&tmp, snapshot, "old.value")); + cl_assert_equal_i(5, tmp); git_config_free(snapshot); git_config_free(cfg); |
