File: worktree_helpers.c

package info (click to toggle)
libgit2 1.1.0%2Bdfsg.1-4%2Bdeb11u2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 53,324 kB
  • sloc: ansic: 173,567; sh: 562; python: 351; php: 65; makefile: 50
file content (30 lines) | stat: -rw-r--r-- 705 bytes parent folder | download | duplicates (8)
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
#include "clar_libgit2.h"
#include "worktree_helpers.h"

void cleanup_fixture_worktree(worktree_fixture *fixture)
{
	if (!fixture)
		return;

	if (fixture->repo) {
		git_repository_free(fixture->repo);
		fixture->repo = NULL;
	}
	if (fixture->worktree) {
		git_repository_free(fixture->worktree);
		fixture->worktree = NULL;
	}

	if (fixture->reponame)
		cl_fixture_cleanup(fixture->reponame);
	if (fixture->worktreename)
		cl_fixture_cleanup(fixture->worktreename);
}

void setup_fixture_worktree(worktree_fixture *fixture)
{
	if (fixture->reponame)
		fixture->repo = cl_git_sandbox_init(fixture->reponame);
	if (fixture->worktreename)
		fixture->worktree = cl_git_sandbox_init(fixture->worktreename);
}