libgit2/tests/repo/repo_helpers.c
Carlos Martín Nieto 659cf2029f Remove the signature from ref-modifying functions
The signature for the reflog is not something which changes
dynamically. Almost all uses will be NULL, since we want for the
repository's default identity to be used, making it noise.

In order to allow for changing the identity, we instead provide
git_repository_set_ident() and git_repository_ident() which allow a user
to override the choice of signature.
2015-03-03 14:40:50 +01:00

23 lines
542 B
C

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