Commit 822d9dd5 by Ben Straub

Remove duplicate of git_repository_head_tree.

parent 1c7eb971
...@@ -23,29 +23,6 @@ ...@@ -23,29 +23,6 @@
GIT_BEGIN_DECL 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 typedef struct tree_walk_data
{ {
git_indexer_stats *stats; git_indexer_stats *stats;
...@@ -160,7 +137,7 @@ int git_checkout_force(git_repository *repo, 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. */ /* TODO: stats->total is never calculated. */
if (!get_head_tree(&tree, repo)) { if (!git_repository_head_tree(&tree, repo)) {
/* Checkout the files */ /* Checkout the files */
if (!git_tree_walk(tree, checkout_walker, GIT_TREEWALK_POST, &payload)) { if (!git_tree_walk(tree, checkout_walker, GIT_TREEWALK_POST, &payload)) {
retcode = 0; retcode = 0;
......
...@@ -3,6 +3,9 @@ ...@@ -3,6 +3,9 @@
#include "git2/clone.h" #include "git2/clone.h"
#include "repository.h" #include "repository.h"
#define DO_LIVE_NETWORK_TESTS 0
static git_repository *g_repo; static git_repository *g_repo;
void test_clone_clone__initialize(void) void test_clone_clone__initialize(void)
...@@ -74,7 +77,7 @@ void test_clone_clone__local(void) ...@@ -74,7 +77,7 @@ void test_clone_clone__local(void)
git_buf src = GIT_BUF_INIT; git_buf src = GIT_BUF_INIT;
build_local_file_url(&src, cl_fixture("testrepo.git")); 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)); cl_git_pass(git_clone(&g_repo, git_buf_cstr(&src), "./local", NULL));
git_repository_free(g_repo); git_repository_free(g_repo);
git_futils_rmdir_r("./local", GIT_DIRREMOVAL_FILES_AND_DIRS); git_futils_rmdir_r("./local", GIT_DIRREMOVAL_FILES_AND_DIRS);
...@@ -88,7 +91,7 @@ void test_clone_clone__local(void) ...@@ -88,7 +91,7 @@ void test_clone_clone__local(void)
void test_clone_clone__network_full(void) void test_clone_clone__network_full(void)
{ {
#if 0 #if DO_LIVE_NETWORK_TESTS
git_remote *origin; git_remote *origin;
cl_git_pass(git_clone(&g_repo, "http://github.com/libgit2/node-gitteh", "./attr", NULL)); 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) ...@@ -100,7 +103,7 @@ void test_clone_clone__network_full(void)
void test_clone_clone__network_bare(void) void test_clone_clone__network_bare(void)
{ {
#if 0 #if DO_LIVE_NETWORK_TESTS
git_remote *origin; git_remote *origin;
cl_git_pass(git_clone_bare(&g_repo, "http://github.com/libgit2/node-gitteh", "attr", NULL)); 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) ...@@ -113,9 +116,7 @@ void test_clone_clone__network_bare(void)
void test_clone_clone__already_exists(void) void test_clone_clone__already_exists(void)
{ {
#if 0 #if DO_LIVE_NETWORK_TESTS
int bar;
/* Should pass with existing-but-empty dir */ /* Should pass with existing-but-empty dir */
p_mkdir("./foo", GIT_DIR_MODE); p_mkdir("./foo", GIT_DIR_MODE);
cl_git_pass(git_clone(&g_repo, cl_git_pass(git_clone(&g_repo,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment