summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2018-02-18 11:49:08 +0000
committerEdward Thomson <ethomson@edwardthomson.com>2018-06-26 09:52:36 +0100
commit08ea0d7dcc699e3963e0ff7b621fb9524672610a (patch)
treeccc1fb0d178cb5256fec5447fecd3b4a4acd44fb
parentc4ce017fd5e829a81860470fc4a26ae34f537841 (diff)
downloadlibgit2-08ea0d7dcc699e3963e0ff7b621fb9524672610a.tar.gz
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.
-rw-r--r--tests/index/reuc.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/tests/index/reuc.c b/tests/index/reuc.c
index e57facc0c..82ae42b00 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);
}