Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
822d9dd5
Commit
822d9dd5
authored
Jul 11, 2012
by
Ben Straub
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove duplicate of git_repository_head_tree.
parent
1c7eb971
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
30 deletions
+8
-30
src/checkout.c
+1
-24
tests-clar/clone/clone.c
+7
-6
No files found.
src/checkout.c
View file @
822d9dd5
...
...
@@ -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
(
!
g
et
_head_tree
(
&
tree
,
repo
))
{
if
(
!
g
it_repository
_head_tree
(
&
tree
,
repo
))
{
/* Checkout the files */
if
(
!
git_tree_walk
(
tree
,
checkout_walker
,
GIT_TREEWALK_POST
,
&
payload
))
{
retcode
=
0
;
...
...
tests-clar/clone/clone.c
View file @
822d9dd5
...
...
@@ -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
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment