index::reuc tests: test that checkout succeeds The index::reuc tests must test that the checkout itself succeeds, otherwise subsequent tests are not valid. In fact, the checkouts were failing because when checking out `SAFE`, they cannot update the files that are in conflict. Change the checkout level to `FORCE` to ensure that they get updated correctly.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
diff --git a/tests/index/reuc.c b/tests/index/reuc.c
index e57facc..82ae42b 100644
--- a/tests/index/reuc.c
+++ b/tests/index/reuc.c
@@ -338,12 +338,12 @@ void test_index_reuc__cleaned_on_checkout_tree(void)
git_object *obj;
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
- opts.checkout_strategy = GIT_CHECKOUT_SAFE | GIT_CHECKOUT_UPDATE_ONLY;
+ opts.checkout_strategy = GIT_CHECKOUT_FORCE;
test_index_reuc__add();
- git_reference_name_to_id(&oid, repo, "refs/heads/master");
- git_object_lookup(&obj, repo, &oid, GIT_OBJ_ANY);
- git_checkout_tree(repo, obj, &opts);
+ cl_git_pass(git_reference_name_to_id(&oid, repo, "refs/heads/master"));
+ cl_git_pass(git_object_lookup(&obj, repo, &oid, GIT_OBJ_ANY));
+ cl_git_pass(git_checkout_tree(repo, obj, &opts));
cl_assert(reuc_entry_exists() == false);
git_object_free(obj);
@@ -353,10 +353,10 @@ void test_index_reuc__cleaned_on_checkout_head(void)
{
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
- opts.checkout_strategy = GIT_CHECKOUT_SAFE | GIT_CHECKOUT_UPDATE_ONLY;
+ opts.checkout_strategy = GIT_CHECKOUT_FORCE;
test_index_reuc__add();
- git_checkout_head(repo, &opts);
+ cl_git_pass(git_checkout_head(repo, &opts));
cl_assert(reuc_entry_exists() == false);
}
@@ -364,9 +364,9 @@ void test_index_reuc__retained_on_checkout_index(void)
{
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
- opts.checkout_strategy = GIT_CHECKOUT_SAFE | GIT_CHECKOUT_UPDATE_ONLY;
+ opts.checkout_strategy = GIT_CHECKOUT_FORCE;
test_index_reuc__add();
- git_checkout_index(repo, repo_index, &opts);
+ cl_git_pass(git_checkout_index(repo, repo_index, &opts));
cl_assert(reuc_entry_exists() == true);
}