mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-28 19:23:05 +00:00
Remove duplicate of git_repository_head_tree.
This commit is contained in:
parent
1c7eb971ac
commit
822d9dd51f
@ -23,29 +23,6 @@
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
|
||||
static int get_head_tree(git_tree **out, git_repository *repo)
|
||||
{
|
||||
int retcode = GIT_ERROR;
|
||||
git_reference *head = NULL;
|
||||
|
||||
/* Dereference HEAD all the way to an OID ref */
|
||||
if (!git_reference_lookup_resolved(&head, repo, GIT_HEAD_FILE, -1)) {
|
||||
/* The OID should be a commit */
|
||||
git_object *commit;
|
||||
if (!git_object_lookup(&commit, repo,
|
||||
git_reference_oid(head), GIT_OBJ_COMMIT)) {
|
||||
/* Get the tree */
|
||||
if (!git_commit_tree(out, (git_commit*)commit)) {
|
||||
retcode = 0;
|
||||
}
|
||||
git_object_free(commit);
|
||||
}
|
||||
git_reference_free(head);
|
||||
}
|
||||
|
||||
return retcode;
|
||||
}
|
||||
|
||||
typedef struct tree_walk_data
|
||||
{
|
||||
git_indexer_stats *stats;
|
||||
@ -160,7 +137,7 @@ int git_checkout_force(git_repository *repo, git_indexer_stats *stats)
|
||||
|
||||
/* TODO: stats->total is never calculated. */
|
||||
|
||||
if (!get_head_tree(&tree, repo)) {
|
||||
if (!git_repository_head_tree(&tree, repo)) {
|
||||
/* Checkout the files */
|
||||
if (!git_tree_walk(tree, checkout_walker, GIT_TREEWALK_POST, &payload)) {
|
||||
retcode = 0;
|
||||
|
@ -3,6 +3,9 @@
|
||||
#include "git2/clone.h"
|
||||
#include "repository.h"
|
||||
|
||||
#define DO_LIVE_NETWORK_TESTS 0
|
||||
|
||||
|
||||
static git_repository *g_repo;
|
||||
|
||||
void test_clone_clone__initialize(void)
|
||||
@ -74,7 +77,7 @@ void test_clone_clone__local(void)
|
||||
git_buf src = GIT_BUF_INIT;
|
||||
build_local_file_url(&src, cl_fixture("testrepo.git"));
|
||||
|
||||
#if 0
|
||||
#if DO_LIVE_NETWORK_TESTS
|
||||
cl_git_pass(git_clone(&g_repo, git_buf_cstr(&src), "./local", NULL));
|
||||
git_repository_free(g_repo);
|
||||
git_futils_rmdir_r("./local", GIT_DIRREMOVAL_FILES_AND_DIRS);
|
||||
@ -88,7 +91,7 @@ void test_clone_clone__local(void)
|
||||
|
||||
void test_clone_clone__network_full(void)
|
||||
{
|
||||
#if 0
|
||||
#if DO_LIVE_NETWORK_TESTS
|
||||
git_remote *origin;
|
||||
|
||||
cl_git_pass(git_clone(&g_repo, "http://github.com/libgit2/node-gitteh", "./attr", NULL));
|
||||
@ -100,7 +103,7 @@ void test_clone_clone__network_full(void)
|
||||
|
||||
void test_clone_clone__network_bare(void)
|
||||
{
|
||||
#if 0
|
||||
#if DO_LIVE_NETWORK_TESTS
|
||||
git_remote *origin;
|
||||
|
||||
cl_git_pass(git_clone_bare(&g_repo, "http://github.com/libgit2/node-gitteh", "attr", NULL));
|
||||
@ -113,9 +116,7 @@ void test_clone_clone__network_bare(void)
|
||||
|
||||
void test_clone_clone__already_exists(void)
|
||||
{
|
||||
#if 0
|
||||
int bar;
|
||||
|
||||
#if DO_LIVE_NETWORK_TESTS
|
||||
/* Should pass with existing-but-empty dir */
|
||||
p_mkdir("./foo", GIT_DIR_MODE);
|
||||
cl_git_pass(git_clone(&g_repo,
|
||||
|
Loading…
Reference in New Issue
Block a user