From bbe6dbec81d2050fb52b600bc27e2dacdc780e77 Mon Sep 17 00:00:00 2001 From: Russell Belfer Date: Wed, 14 Nov 2012 23:29:48 -0800 Subject: Add explicit git_index ptr to diff and checkout A number of diff APIs and the `git_checkout_index` API take a `git_repository` object an operate on the index. This updates them to take a `git_index` pointer explicitly and only fall back on the `git_repository` index if the index input is NULL. This makes it easier to operate on a temporary index. --- tests-clar/diff/diffiter.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'tests-clar/diff/diffiter.c') diff --git a/tests-clar/diff/diffiter.c b/tests-clar/diff/diffiter.c index f021d46f4..133392c21 100644 --- a/tests-clar/diff/diffiter.c +++ b/tests-clar/diff/diffiter.c @@ -16,7 +16,7 @@ void test_diff_diffiter__create(void) git_diff_list *diff; size_t d, num_d; - cl_git_pass(git_diff_workdir_to_index(&diff, repo, NULL)); + cl_git_pass(git_diff_workdir_to_index(&diff, repo, NULL, NULL)); num_d = git_diff_num_deltas(diff); for (d = 0; d < num_d; ++d) { @@ -34,7 +34,7 @@ void test_diff_diffiter__iterate_files(void) size_t d, num_d; int count = 0; - cl_git_pass(git_diff_workdir_to_index(&diff, repo, NULL)); + cl_git_pass(git_diff_workdir_to_index(&diff, repo, NULL, NULL)); num_d = git_diff_num_deltas(diff); cl_assert_equal_i(6, (int)num_d); @@ -57,7 +57,7 @@ void test_diff_diffiter__iterate_files_2(void) size_t d, num_d; int count = 0; - cl_git_pass(git_diff_workdir_to_index(&diff, repo, NULL)); + cl_git_pass(git_diff_workdir_to_index(&diff, repo, NULL, NULL)); num_d = git_diff_num_deltas(diff); cl_assert_equal_i(8, (int)num_d); @@ -85,7 +85,7 @@ void test_diff_diffiter__iterate_files_and_hunks(void) opts.interhunk_lines = 1; opts.flags |= GIT_DIFF_INCLUDE_IGNORED | GIT_DIFF_INCLUDE_UNTRACKED; - cl_git_pass(git_diff_workdir_to_index(&diff, repo, &opts)); + cl_git_pass(git_diff_workdir_to_index(&diff, repo, NULL, &opts)); num_d = git_diff_num_deltas(diff); @@ -138,7 +138,7 @@ void test_diff_diffiter__max_size_threshold(void) opts.interhunk_lines = 1; opts.flags |= GIT_DIFF_INCLUDE_IGNORED | GIT_DIFF_INCLUDE_UNTRACKED; - cl_git_pass(git_diff_workdir_to_index(&diff, repo, &opts)); + cl_git_pass(git_diff_workdir_to_index(&diff, repo, NULL, &opts)); num_d = git_diff_num_deltas(diff); for (d = 0; d < num_d; ++d) { @@ -173,7 +173,7 @@ void test_diff_diffiter__max_size_threshold(void) opts.flags |= GIT_DIFF_INCLUDE_IGNORED | GIT_DIFF_INCLUDE_UNTRACKED; opts.max_size = 50; /* treat anything over 50 bytes as binary! */ - cl_git_pass(git_diff_workdir_to_index(&diff, repo, &opts)); + cl_git_pass(git_diff_workdir_to_index(&diff, repo, NULL, &opts)); num_d = git_diff_num_deltas(diff); for (d = 0; d < num_d; ++d) { @@ -216,7 +216,7 @@ void test_diff_diffiter__iterate_all(void) opts.interhunk_lines = 1; opts.flags |= GIT_DIFF_INCLUDE_IGNORED | GIT_DIFF_INCLUDE_UNTRACKED; - cl_git_pass(git_diff_workdir_to_index(&diff, repo, &opts)); + cl_git_pass(git_diff_workdir_to_index(&diff, repo, NULL, &opts)); num_d = git_diff_num_deltas(diff); for (d = 0; d < num_d; ++d) { @@ -292,7 +292,7 @@ void test_diff_diffiter__iterate_randomly_while_saving_state(void) opts.interhunk_lines = 1; opts.flags |= GIT_DIFF_INCLUDE_IGNORED | GIT_DIFF_INCLUDE_UNTRACKED; - cl_git_pass(git_diff_workdir_to_index(&diff, repo, &opts)); + cl_git_pass(git_diff_workdir_to_index(&diff, repo, NULL, &opts)); num_d = git_diff_num_deltas(diff); @@ -419,7 +419,7 @@ void test_diff_diffiter__iterate_and_generate_patch_text(void) git_diff_list *diff; size_t d, num_d; - cl_git_pass(git_diff_workdir_to_index(&diff, repo, NULL)); + cl_git_pass(git_diff_workdir_to_index(&diff, repo, NULL, NULL)); num_d = git_diff_num_deltas(diff); cl_assert_equal_i(8, (int)num_d); -- cgit v1.2.1