Remove duplicate of git_repository_head_tree.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
diff --git a/src/checkout.c b/src/checkout.c
index 58ae7f2..b9b5bc1 100644
--- a/src/checkout.c
+++ b/src/checkout.c
@@ -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;
diff --git a/tests-clar/clone/clone.c b/tests-clar/clone/clone.c
index 78202d7..b0c8479 100644
--- a/tests-clar/clone/clone.c
+++ b/tests-clar/clone/clone.c
@@ -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,