]> git.proxmox.com Git - libgit2.git/blob - tests/worktree/worktree_helpers.c
New upstream version 1.4.3+dfsg.1
[libgit2.git] / tests / worktree / worktree_helpers.c
1 #include "clar_libgit2.h"
2 #include "worktree_helpers.h"
3
4 void cleanup_fixture_worktree(worktree_fixture *fixture)
5 {
6 if (!fixture)
7 return;
8
9 if (fixture->repo) {
10 git_repository_free(fixture->repo);
11 fixture->repo = NULL;
12 }
13 if (fixture->worktree) {
14 git_repository_free(fixture->worktree);
15 fixture->worktree = NULL;
16 }
17
18 if (fixture->reponame)
19 cl_fixture_cleanup(fixture->reponame);
20 if (fixture->worktreename)
21 cl_fixture_cleanup(fixture->worktreename);
22 }
23
24 void setup_fixture_worktree(worktree_fixture *fixture)
25 {
26 if (fixture->reponame)
27 fixture->repo = cl_git_sandbox_init(fixture->reponame);
28 if (fixture->worktreename)
29 fixture->worktree = cl_git_sandbox_init(fixture->worktreename);
30 }