diff options
author | Russell Belfer <rb@github.com> | 2013-10-04 16:32:16 -0700 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2013-10-04 16:32:16 -0700 |
commit | 5173ea921d4ccbbe7d61ddce9a0920c2e1c82035 (patch) | |
tree | d7aec2a09ff9f26cb8457a7e00eec89d10515bc8 /tests-clar/diff/diffiter.c | |
parent | b8f9059d6330d1b0113910eb4c6f049ea5a150a4 (diff) | |
download | libgit2-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/diffiter.c')
-rw-r--r-- | tests-clar/diff/diffiter.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tests-clar/diff/diffiter.c b/tests-clar/diff/diffiter.c index 932d720f2..ea5908475 100644 --- a/tests-clar/diff/diffiter.c +++ b/tests-clar/diff/diffiter.c @@ -27,25 +27,25 @@ void test_diff_diffiter__create(void) git_diff_list_free(diff); } -void test_diff_diffiter__iterate_files(void) +void test_diff_diffiter__iterate_files_1(void) { git_repository *repo = cl_git_sandbox_init("attr"); git_diff_list *diff; size_t d, num_d; - int count = 0; + diff_expects exp = { 0 }; cl_git_pass(git_diff_index_to_workdir(&diff, repo, NULL, NULL)); num_d = git_diff_num_deltas(diff); - cl_assert_equal_i(6, (int)num_d); for (d = 0; d < num_d; ++d) { const git_diff_delta *delta; cl_git_pass(git_diff_get_patch(NULL, &delta, diff, d)); cl_assert(delta != NULL); - count++; + + diff_file_cb(delta, (float)d / (float)num_d, &exp); } - cl_assert_equal_i(6, count); + cl_assert_equal_sz(6, exp.files); git_diff_list_free(diff); } |