Commit 8b0ffdcb by punkymaniac Committed by Edward Thomson

Add test for `git_worktree_add` no checkout

parent 58451759
......@@ -292,6 +292,27 @@ void test_worktree_worktree__add_with_explicit_branch(void)
git_worktree_free(wt);
}
void test_worktree_worktree__add_no_checkout(void)
{
git_worktree *wt;
git_repository *wtrepo;
git_index *index;
git_buf path = GIT_BUF_INIT;
git_worktree_add_options opts = GIT_WORKTREE_ADD_OPTIONS_INIT;
opts.checkout_opts.checkout_strategy = GIT_CHECKOUT_NONE;
cl_git_pass(git_buf_joinpath(&path, fixture.repo->workdir, "../worktree-no-checkout"));
cl_git_pass(git_worktree_add(&wt, fixture.repo, "worktree-no-checkout", path.ptr, &opts));
cl_git_pass(git_repository_open(&wtrepo, path.ptr));
cl_git_pass(git_repository_index(&index, wtrepo));
cl_assert_equal_i(git_index_entrycount(index), 0);
git_buf_dispose(&path);
git_worktree_free(wt);
git_repository_free(wtrepo);
}
void test_worktree_worktree__init_existing_worktree(void)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment