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
aa3af01d
Commit
aa3af01d
authored
May 13, 2015
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
index iterator: optionally include conflicts
parent
c7f94123
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
6 deletions
+12
-6
src/iterator.c
+10
-6
src/iterator.h
+2
-0
No files found.
src/iterator.c
View file @
aa3af01d
...
...
@@ -46,6 +46,7 @@
#define iterator__include_trees(I) iterator__flag(I,INCLUDE_TREES)
#define iterator__dont_autoexpand(I) iterator__flag(I,DONT_AUTOEXPAND)
#define iterator__do_autoexpand(I) !iterator__flag(I,DONT_AUTOEXPAND)
#define iterator__include_conflicts(I) iterator__flag(I, INCLUDE_CONFLICTS)
#define GIT_ITERATOR_FIRST_ACCESS (1 << 15)
#define iterator__has_been_accessed(I) iterator__flag(I,FIRST_ACCESS)
...
...
@@ -668,13 +669,16 @@ static const git_index_entry *index_iterator__index_entry(index_iterator *ii)
return
ie
;
}
static
const
git_index_entry
*
index_iterator__
skip
_conflicts
(
index_iterator
*
ii
)
static
const
git_index_entry
*
index_iterator__
advance_over
_conflicts
(
index_iterator
*
ii
)
{
const
git_index_entry
*
ie
;
const
git_index_entry
*
ie
=
index_iterator__index_entry
(
ii
)
;
while
((
ie
=
index_iterator__index_entry
(
ii
))
!=
NULL
&&
git_index_entry_stage
(
ie
)
!=
0
)
if
(
!
iterator__include_conflicts
(
ii
))
{
while
(
ie
&&
git_index_entry_stage
(
ie
)
!=
0
)
{
ii
->
current
++
;
ie
=
index_iterator__index_entry
(
ii
);
}
}
return
ie
;
}
...
...
@@ -702,7 +706,7 @@ static void index_iterator__next_prefix_tree(index_iterator *ii)
static
int
index_iterator__first_prefix_tree
(
index_iterator
*
ii
)
{
const
git_index_entry
*
ie
=
index_iterator__
skip
_conflicts
(
ii
);
const
git_index_entry
*
ie
=
index_iterator__
advance_over
_conflicts
(
ii
);
const
char
*
scan
,
*
prior
,
*
slash
;
if
(
!
ie
||
!
iterator__include_trees
(
ii
))
...
...
@@ -825,7 +829,7 @@ static int index_iterator__reset(
git_index_snapshot_find
(
&
ii
->
current
,
&
ii
->
entries
,
ii
->
entry_srch
,
ii
->
base
.
start
,
0
,
0
);
if
((
ie
=
index_iterator__
skip
_conflicts
(
ii
))
==
NULL
)
if
((
ie
=
index_iterator__
advance_over
_conflicts
(
ii
))
==
NULL
)
return
0
;
if
(
git_buf_sets
(
&
ii
->
partial
,
ie
->
path
)
<
0
)
...
...
src/iterator.h
View file @
aa3af01d
...
...
@@ -33,6 +33,8 @@ typedef enum {
GIT_ITERATOR_DONT_AUTOEXPAND
=
(
1u
<<
3
),
/** convert precomposed unicode to decomposed unicode */
GIT_ITERATOR_PRECOMPOSE_UNICODE
=
(
1u
<<
4
),
/** include conflicts */
GIT_ITERATOR_INCLUDE_CONFLICTS
=
(
1u
<<
5
),
}
git_iterator_flag_t
;
typedef
struct
{
...
...
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