summaryrefslogtreecommitdiff
path: root/tests-clar/diff/patch.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-10-04 16:32:16 -0700
committerRussell Belfer <rb@github.com>2013-10-04 16:32:16 -0700
commit5173ea921d4ccbbe7d61ddce9a0920c2e1c82035 (patch)
treed7aec2a09ff9f26cb8457a7e00eec89d10515bc8 /tests-clar/diff/patch.c
parentb8f9059d6330d1b0113910eb4c6f049ea5a150a4 (diff)
downloadlibgit2-5173ea921d4ccbbe7d61ddce9a0920c2e1c82035.tar.gz
Add git_repository_reset_filesystem and fix tests
When a repository is transferred from one file system to another, many of the config settings that represent the properties of the file system may be wrong. This adds a new public API that will refresh the config settings of the repository to account for the change of file system. This doesn't do a full "reinitialize" and operates on a existing git_repository object refreshing the config when done. This commit then makes use of the new API in clar as each test repository is set up. This commit also has a number of other clar test fixes where we were making assumptions about the type of filesystem, either based on outdated config data or based on the OS instead of the FS.
Diffstat (limited to 'tests-clar/diff/patch.c')
-rw-r--r--tests-clar/diff/patch.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/tests-clar/diff/patch.c b/tests-clar/diff/patch.c
index 6a33fa990..7aab8f409 100644
--- a/tests-clar/diff/patch.c
+++ b/tests-clar/diff/patch.c
@@ -238,6 +238,9 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
cl_git_pass(git_config_new(&cfg));
git_repository_set_config(g_repo, cfg);
+ git_config_free(cfg);
+
+ git_repository_reset_filesystem(g_repo);
cl_git_pass(
git_futils_readbuffer(&old_content, "renames/songof7cities.txt"));
@@ -408,7 +411,6 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
git_buf_free(&actual);
git_buf_free(&old_content);
git_tree_free(head);
- git_config_free(cfg);
}
static void check_single_patch_stats(
@@ -520,6 +522,9 @@ void test_diff_patch__line_counts_with_eofnl(void)
cl_git_pass(git_config_new(&cfg));
git_repository_set_config(g_repo, cfg);
+ git_config_free(cfg);
+
+ git_repository_reset_filesystem(g_repo);
cl_git_pass(git_futils_readbuffer(&content, "renames/songof7cities.txt"));
@@ -574,5 +579,4 @@ void test_diff_patch__line_counts_with_eofnl(void)
g_repo, 1, 1, 1, 6, expected_sizes, expected);
git_buf_free(&content);
- git_config_free(cfg);
}