diff options
author | Russell Belfer <rb@github.com> | 2013-03-22 14:27:56 -0700 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2013-03-22 14:27:56 -0700 |
commit | 1323c6d18049163fc81e5e246e7d4e120c8de03a (patch) | |
tree | a75d2a576d38890a8c009b299ec2cb744d571282 /tests-clar/checkout/tree.c | |
parent | 3ba01362437102501a173b9fe072a5690358baa0 (diff) | |
download | libgit2-1323c6d18049163fc81e5e246e7d4e120c8de03a.tar.gz |
Add cl_repo_set_bool and cleanup tests
This adds a helper function for the cases where you want to
quickly set a single boolean config value for a repository.
This allowed me to remove a lot of code.
Diffstat (limited to 'tests-clar/checkout/tree.c')
-rw-r--r-- | tests-clar/checkout/tree.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/tests-clar/checkout/tree.c b/tests-clar/checkout/tree.c index 348be51a8..8309cd721 100644 --- a/tests-clar/checkout/tree.c +++ b/tests-clar/checkout/tree.c @@ -452,32 +452,31 @@ void test_checkout_tree__can_checkout_with_last_workdir_item_missing(void) git_oid tree_id, commit_id; git_tree *tree = NULL; git_commit *commit = NULL; - + git_repository_index(&index, g_repo); - + opts.checkout_strategy = GIT_CHECKOUT_FORCE; - + cl_git_pass(git_reference_name_to_id(&commit_id, g_repo, "refs/heads/master")); cl_git_pass(git_commit_lookup(&commit, g_repo, &commit_id)); - + cl_git_pass(git_checkout_tree(g_repo, (git_object *)commit, &opts)); cl_git_pass(git_repository_set_head(g_repo, "refs/heads/master")); - - + cl_git_pass(p_mkdir("./testrepo/this-is-dir", 0777)); cl_git_mkfile("./testrepo/this-is-dir/contained_file", "content\n"); - + cl_git_pass(git_index_add_bypath(index, "this-is-dir/contained_file")); git_index_write_tree(&tree_id, index); cl_git_pass(git_tree_lookup(&tree, g_repo, &tree_id)); - + cl_git_pass(p_unlink("./testrepo/this-is-dir/contained_file")); - + opts.checkout_strategy = GIT_CHECKOUT_SAFE; - + opts.checkout_strategy = 1; git_checkout_tree(g_repo, (git_object *)tree, &opts); - + git_tree_free(tree); git_commit_free(commit); git_index_free(index); |