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
0ef0b71c
Commit
0ef0b71c
authored
Mar 21, 2016
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
iterator: refactor index iterator
parent
ba6f86eb
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
35 deletions
+44
-35
src/iterator.c
+0
-0
tests/iterator/index.c
+0
-0
tests/iterator/iterator_helpers.c
+36
-0
tests/iterator/iterator_helpers.h
+8
-0
tests/iterator/workdir.c
+0
-35
No files found.
src/iterator.c
View file @
0ef0b71c
This diff is collapsed.
Click to expand it.
tests/iterator/index.c
View file @
0ef0b71c
This diff is collapsed.
Click to expand it.
tests/iterator/iterator_helpers.c
View file @
0ef0b71c
...
...
@@ -108,3 +108,39 @@ void expect_iterator_items(
cl_assert_equal_i
(
expected_total
,
count
);
}
void
expect_advance_over
(
git_iterator
*
i
,
const
char
*
expected_path
,
git_iterator_status_t
expected_status
)
{
const
git_index_entry
*
entry
;
git_iterator_status_t
status
;
int
error
;
cl_git_pass
(
git_iterator_current
(
&
entry
,
i
));
cl_assert_equal_s
(
expected_path
,
entry
->
path
);
error
=
git_iterator_advance_over
(
&
entry
,
&
status
,
i
);
cl_assert
(
!
error
||
error
==
GIT_ITEROVER
);
cl_assert_equal_i
(
expected_status
,
status
);
}
void
expect_advance_into
(
git_iterator
*
i
,
const
char
*
expected_path
)
{
const
git_index_entry
*
entry
;
int
error
;
cl_git_pass
(
git_iterator_current
(
&
entry
,
i
));
cl_assert_equal_s
(
expected_path
,
entry
->
path
);
if
(
S_ISDIR
(
entry
->
mode
))
error
=
git_iterator_advance_into
(
&
entry
,
i
);
else
error
=
git_iterator_advance
(
&
entry
,
i
);
cl_assert
(
!
error
||
error
==
GIT_ITEROVER
);
}
tests/iterator/iterator_helpers.h
View file @
0ef0b71c
...
...
@@ -6,3 +6,11 @@ extern void expect_iterator_items(
int
expected_total
,
const
char
**
expected_total_paths
);
extern
void
expect_advance_over
(
git_iterator
*
i
,
const
char
*
expected_path
,
git_iterator_status_t
expected_status
);
void
expect_advance_into
(
git_iterator
*
i
,
const
char
*
expected_path
);
tests/iterator/workdir.c
View file @
0ef0b71c
...
...
@@ -1243,23 +1243,6 @@ void test_iterator_workdir__bounded_submodules(void)
git_tree_free
(
head
);
}
static
void
expect_advance_over
(
git_iterator
*
i
,
const
char
*
expected_path
,
git_iterator_status_t
expected_status
)
{
const
git_index_entry
*
entry
;
git_iterator_status_t
status
;
int
error
;
cl_git_pass
(
git_iterator_current
(
&
entry
,
i
));
cl_assert_equal_s
(
expected_path
,
entry
->
path
);
error
=
git_iterator_advance_over
(
&
entry
,
&
status
,
i
);
cl_assert
(
!
error
||
error
==
GIT_ITEROVER
);
cl_assert_equal_i
(
expected_status
,
status
);
}
void
test_iterator_workdir__advance_over
(
void
)
{
git_iterator
*
i
;
...
...
@@ -1380,24 +1363,6 @@ void test_iterator_workdir__advance_over_with_pathlist(void)
git_vector_free
(
&
pathlist
);
}
static
void
expect_advance_into
(
git_iterator
*
i
,
const
char
*
expected_path
)
{
const
git_index_entry
*
entry
;
int
error
;
cl_git_pass
(
git_iterator_current
(
&
entry
,
i
));
cl_assert_equal_s
(
expected_path
,
entry
->
path
);
if
(
S_ISDIR
(
entry
->
mode
))
error
=
git_iterator_advance_into
(
&
entry
,
i
);
else
error
=
git_iterator_advance
(
&
entry
,
i
);
cl_assert
(
!
error
||
error
==
GIT_ITEROVER
);
}
void
test_iterator_workdir__advance_into
(
void
)
{
git_iterator
*
i
;
...
...
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