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
a12c291b
Commit
a12c291b
authored
Apr 03, 2012
by
Vicent Martí
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #617 from schu/tests-fixup
tests-clar: cleanup
parents
471bb8b1
13ed2966
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
38 deletions
+13
-38
tests-clar/commit/write.c
+11
-8
tests-clar/index/tests.c
+2
-0
tests-clar/object/tree/write.c
+0
-30
No files found.
tests-clar/commit/write.c
View file @
a12c291b
...
...
@@ -6,8 +6,10 @@ static const char *commit_message = "This commit has been created in memory\n\
This is a commit created in memory and it will be written back to disk
\n
"
;
static
const
char
*
tree_oid
=
"1810dff58d8a660512d4832e740f692884338ccd"
;
static
const
char
*
root_commit_message
=
"This is a root commit
\n
\
This is a root commit and should be the only one in this branch
\n
"
;
This is a root commit and should be the only one in this branch
\n
"
;
static
char
*
head_old
;
static
git_reference
*
head
,
*
branch
;
static
git_commit
*
commit
;
// Fixture setup
static
git_repository
*
g_repo
;
...
...
@@ -17,6 +19,13 @@ void test_commit_write__initialize(void)
}
void
test_commit_write__cleanup
(
void
)
{
git_reference_free
(
head
);
git_reference_free
(
branch
);
git_commit_free
(
commit
);
git__free
(
head_old
);
cl_git_sandbox_cleanup
();
}
...
...
@@ -24,7 +33,6 @@ void test_commit_write__cleanup(void)
// write a new commit object from memory to disk
void
test_commit_write__from_memory
(
void
)
{
git_commit
*
commit
;
git_oid
tree_id
,
parent_id
,
commit_id
;
git_signature
*
author
,
*
committer
;
const
git_signature
*
author1
,
*
committer1
;
...
...
@@ -79,18 +87,13 @@ void test_commit_write__from_memory(void)
cl_assert
(
strcmp
(
git_commit_message
(
commit
),
commit_message
)
==
0
);
}
// create a root commit
void
test_commit_write__root
(
void
)
{
git_commit
*
commit
;
git_oid
tree_id
,
commit_id
;
const
git_oid
*
branch_oid
;
git_signature
*
author
,
*
committer
;
const
char
*
branch_name
=
"refs/heads/root-commit-branch"
;
git_reference
*
head
,
*
branch
;
char
*
head_old
;
git_tree
*
tree
;
git_oid_fromstr
(
&
tree_id
,
tree_oid
);
...
...
tests-clar/index/tests.c
View file @
a12c291b
...
...
@@ -62,6 +62,8 @@ static void files_are_equal(const char *a, const char *b)
git_buf_free
(
&
buf_a
);
git_buf_free
(
&
buf_b
);
cl_assert
(
pass
);
}
...
...
tests-clar/object/tree/write.c
View file @
a12c291b
...
...
@@ -9,36 +9,6 @@ static const char *third_tree = "eb86d8b81d6adbd5290a935d6c9976882de98488";
static
git_repository
*
g_repo
;
// Helpers
static
int
print_tree
(
git_repository
*
repo
,
const
git_oid
*
tree_oid
,
int
depth
)
{
static
const
char
*
indent
=
" "
;
git_tree
*
tree
;
unsigned
int
i
;
if
(
git_tree_lookup
(
&
tree
,
repo
,
tree_oid
)
<
GIT_SUCCESS
)
return
GIT_ERROR
;
for
(
i
=
0
;
i
<
git_tree_entrycount
(
tree
);
++
i
)
{
const
git_tree_entry
*
entry
=
git_tree_entry_byindex
(
tree
,
i
);
char
entry_oid
[
40
];
git_oid_fmt
(
entry_oid
,
&
entry
->
oid
);
printf
(
"%.*s%o [%.*s] %s
\n
"
,
depth
*
2
,
indent
,
entry
->
attr
,
40
,
entry_oid
,
entry
->
filename
);
if
(
entry
->
attr
==
S_IFDIR
)
{
if
(
print_tree
(
repo
,
&
entry
->
oid
,
depth
+
1
)
<
GIT_SUCCESS
)
{
git_tree_free
(
tree
);
return
GIT_ERROR
;
}
}
}
git_tree_free
(
tree
);
return
GIT_SUCCESS
;
}
// Fixture setup and teardown
void
test_object_tree_write__initialize
(
void
)
{
...
...
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