Blame tests/repo/repo_helpers.c

Packit Service 20376f
#include "clar_libgit2.h"
Packit Service 20376f
#include "refs.h"
Packit Service 20376f
#include "repo_helpers.h"
Packit Service 20376f
#include "posix.h"
Packit Service 20376f
Packit Service 20376f
void make_head_unborn(git_repository* repo, const char *target)
Packit Service 20376f
{
Packit Service 20376f
	git_reference *head;
Packit Service 20376f
Packit Service 20376f
	cl_git_pass(git_reference_symbolic_create(&head, repo, GIT_HEAD_FILE, target, 1, NULL));
Packit Service 20376f
	git_reference_free(head);
Packit Service 20376f
}
Packit Service 20376f
Packit Service 20376f
void delete_head(git_repository* repo)
Packit Service 20376f
{
Packit Service 20376f
	git_buf head_path = GIT_BUF_INIT;
Packit Service 20376f
Packit Service 20376f
	cl_git_pass(git_buf_joinpath(&head_path, git_repository_path(repo), GIT_HEAD_FILE));
Packit Service 20376f
	cl_git_pass(p_unlink(git_buf_cstr(&head_path)));
Packit Service 20376f
Packit Service 20376f
	git_buf_free(&head_path);
Packit Service 20376f
}