]> git.proxmox.com Git - libgit2.git/blame - tests/repo/repo_helpers.c
Merge pull request #2908 from ethomson/safe_create
[libgit2.git] / tests / repo / repo_helpers.c
CommitLineData
cd1ef822 1#include "clar_libgit2.h"
2#include "refs.h"
3#include "repo_helpers.h"
b1a3a70e 4#include "posix.h"
cd1ef822 5
605da51a 6void make_head_unborn(git_repository* repo, const char *target)
cd1ef822 7{
8 git_reference *head;
9
0b28217b 10 cl_git_pass(git_reference_symbolic_create(&head, repo, GIT_HEAD_FILE, target, 1, NULL, NULL));
cd1ef822 11 git_reference_free(head);
12}
b1a3a70e 13
14void delete_head(git_repository* repo)
15{
16 git_buf head_path = GIT_BUF_INIT;
17
18 cl_git_pass(git_buf_joinpath(&head_path, git_repository_path(repo), GIT_HEAD_FILE));
19 cl_git_pass(p_unlink(git_buf_cstr(&head_path)));
20
21 git_buf_free(&head_path);
22}