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
89886d0b
Commit
89886d0b
authored
Nov 28, 2011
by
Carlos Martín Nieto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Plug a bunch of leaks
parent
a5123ea8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
53 additions
and
3 deletions
+53
-3
src/index.c
+11
-0
src/status.c
+1
-0
tests-clay/repo/getters.c
+2
-0
tests/t04-commit.c
+1
-0
tests/t08-tag.c
+1
-0
tests/t10-refs.c
+37
-3
No files found.
src/index.c
View file @
89886d0b
...
@@ -87,6 +87,8 @@ static int parse_index(git_index *index, const char *buffer, size_t buffer_size)
...
@@ -87,6 +87,8 @@ static int parse_index(git_index *index, const char *buffer, size_t buffer_size)
static
int
is_index_extended
(
git_index
*
index
);
static
int
is_index_extended
(
git_index
*
index
);
static
int
write_index
(
git_index
*
index
,
git_filebuf
*
file
);
static
int
write_index
(
git_index
*
index
,
git_filebuf
*
file
);
static
void
index_entry_free
(
git_index_entry
*
entry
);
static
int
index_srch
(
const
void
*
key
,
const
void
*
array_member
)
static
int
index_srch
(
const
void
*
key
,
const
void
*
array_member
)
{
{
const
git_index_entry
*
entry
=
array_member
;
const
git_index_entry
*
entry
=
array_member
;
...
@@ -157,8 +159,17 @@ int git_index_open(git_index **index_out, const char *index_path)
...
@@ -157,8 +159,17 @@ int git_index_open(git_index **index_out, const char *index_path)
static
void
index_free
(
git_index
*
index
)
static
void
index_free
(
git_index
*
index
)
{
{
git_index_entry
*
e
;
unsigned
int
i
;
git_index_clear
(
index
);
git_index_clear
(
index
);
git_vector_foreach
(
&
index
->
entries
,
i
,
e
)
{
index_entry_free
(
e
);
}
git_vector_free
(
&
index
->
entries
);
git_vector_free
(
&
index
->
entries
);
git_vector_foreach
(
&
index
->
unmerged
,
i
,
e
)
{
index_entry_free
(
e
);
}
git_vector_free
(
&
index
->
unmerged
);
git_vector_free
(
&
index
->
unmerged
);
git__free
(
index
->
index_file_path
);
git__free
(
index
->
index_file_path
);
...
...
src/status.c
View file @
89886d0b
...
@@ -154,6 +154,7 @@ static int retrieve_head_tree(git_tree **tree_out, git_repository *repo)
...
@@ -154,6 +154,7 @@ static int retrieve_head_tree(git_tree **tree_out, git_repository *repo)
if
((
error
=
git_commit_lookup
(
&
head_commit
,
repo
,
git_reference_oid
(
resolved_head_ref
)))
<
GIT_SUCCESS
)
if
((
error
=
git_commit_lookup
(
&
head_commit
,
repo
,
git_reference_oid
(
resolved_head_ref
)))
<
GIT_SUCCESS
)
return
git__rethrow
(
error
,
"The tip of HEAD can't be retrieved"
);
return
git__rethrow
(
error
,
"The tip of HEAD can't be retrieved"
);
git_reference_free
(
resolved_head_ref
);
if
((
error
=
git_commit_tree
(
&
tree
,
head_commit
))
<
GIT_SUCCESS
)
{
if
((
error
=
git_commit_tree
(
&
tree
,
head_commit
))
<
GIT_SUCCESS
)
{
error
=
git__rethrow
(
error
,
"The tree of HEAD can't be retrieved"
);
error
=
git__rethrow
(
error
,
"The tree of HEAD can't be retrieved"
);
goto
exit
;
goto
exit
;
...
...
tests-clay/repo/getters.c
View file @
89886d0b
...
@@ -37,6 +37,7 @@ void test_repo_getters__head_detached(void)
...
@@ -37,6 +37,7 @@ void test_repo_getters__head_detached(void)
git_oid_fromstr
(
&
oid
,
"c47800c7266a2be04c571c04d5a6614691ea99bd"
);
git_oid_fromstr
(
&
oid
,
"c47800c7266a2be04c571c04d5a6614691ea99bd"
);
cl_git_pass
(
git_reference_create_oid
(
&
ref
,
repo
,
"HEAD"
,
&
oid
,
1
));
cl_git_pass
(
git_reference_create_oid
(
&
ref
,
repo
,
"HEAD"
,
&
oid
,
1
));
cl_assert
(
git_repository_head_detached
(
repo
)
==
1
);
cl_assert
(
git_repository_head_detached
(
repo
)
==
1
);
git_reference_free
(
ref
);
/* take the reop back to it's original state */
/* take the reop back to it's original state */
cl_git_pass
(
git_reference_create_symbolic
(
&
ref
,
repo
,
"HEAD"
,
"refs/heads/master"
,
1
));
cl_git_pass
(
git_reference_create_symbolic
(
&
ref
,
repo
,
"HEAD"
,
"refs/heads/master"
,
1
));
...
@@ -58,6 +59,7 @@ void test_repo_getters__head_orphan(void)
...
@@ -58,6 +59,7 @@ void test_repo_getters__head_orphan(void)
/* orphan HEAD */
/* orphan HEAD */
cl_git_pass
(
git_reference_create_symbolic
(
&
ref
,
repo
,
"HEAD"
,
"refs/heads/orphan"
,
1
));
cl_git_pass
(
git_reference_create_symbolic
(
&
ref
,
repo
,
"HEAD"
,
"refs/heads/orphan"
,
1
));
cl_assert
(
git_repository_head_orphan
(
repo
)
==
1
);
cl_assert
(
git_repository_head_orphan
(
repo
)
==
1
);
git_reference_free
(
ref
);
/* take the reop back to it's original state */
/* take the reop back to it's original state */
cl_git_pass
(
git_reference_create_symbolic
(
&
ref
,
repo
,
"HEAD"
,
"refs/heads/master"
,
1
));
cl_git_pass
(
git_reference_create_symbolic
(
&
ref
,
repo
,
"HEAD"
,
"refs/heads/master"
,
1
));
...
...
tests/t04-commit.c
View file @
89886d0b
...
@@ -759,6 +759,7 @@ BEGIN_TEST(root0, "create a root commit")
...
@@ -759,6 +759,7 @@ BEGIN_TEST(root0, "create a root commit")
must_be_true
(
!
strcmp
(
git_commit_message
(
commit
),
ROOT_COMMIT_MESSAGE
));
must_be_true
(
!
strcmp
(
git_commit_message
(
commit
),
ROOT_COMMIT_MESSAGE
));
/* Remove the data we just added to the repo */
/* Remove the data we just added to the repo */
git_reference_free
(
head
);
must_pass
(
git_reference_lookup
(
&
head
,
repo
,
"HEAD"
));
must_pass
(
git_reference_lookup
(
&
head
,
repo
,
"HEAD"
));
must_pass
(
git_reference_set_target
(
head
,
head_old
));
must_pass
(
git_reference_set_target
(
head
,
head_old
));
must_pass
(
git_reference_delete
(
branch
));
must_pass
(
git_reference_delete
(
branch
));
...
...
tests/t08-tag.c
View file @
89886d0b
...
@@ -243,6 +243,7 @@ BEGIN_TEST(write3, "Replace an already existing tag")
...
@@ -243,6 +243,7 @@ BEGIN_TEST(write3, "Replace an already existing tag")
must_pass
(
git_reference_lookup
(
&
ref_tag
,
repo
,
"refs/tags/e90810b"
));
must_pass
(
git_reference_lookup
(
&
ref_tag
,
repo
,
"refs/tags/e90810b"
));
git_oid_cpy
(
&
old_tag_id
,
git_reference_oid
(
ref_tag
));
git_oid_cpy
(
&
old_tag_id
,
git_reference_oid
(
ref_tag
));
git_reference_free
(
ref_tag
);
/* create signature */
/* create signature */
must_pass
(
git_signature_new
(
&
tagger
,
TAGGER_NAME
,
TAGGER_EMAIL
,
123456789
,
60
));
must_pass
(
git_signature_new
(
&
tagger
,
TAGGER_NAME
,
TAGGER_EMAIL
,
123456789
,
60
));
...
...
tests/t10-refs.c
View file @
89886d0b
This diff is collapsed.
Click to expand it.
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