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
7cc1bf0f
Commit
7cc1bf0f
authored
Nov 08, 2012
by
nulltoken
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
index: Introduce git_index_has_conflicts()
parent
29cc374d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
0 deletions
+26
-0
include/git2/index.h
+7
-0
src/index.c
+15
-0
tests-clar/index/conflicts.c
+4
-0
No files found.
include/git2/index.h
View file @
7cc1bf0f
...
@@ -431,6 +431,13 @@ GIT_EXTERN(int) git_index_conflict_remove(git_index *index, const char *path);
...
@@ -431,6 +431,13 @@ GIT_EXTERN(int) git_index_conflict_remove(git_index *index, const char *path);
*/
*/
GIT_EXTERN
(
void
)
git_index_conflict_cleanup
(
git_index
*
index
);
GIT_EXTERN
(
void
)
git_index_conflict_cleanup
(
git_index
*
index
);
/**
* Determine if the index contains entries representing file conflicts.
*
* @return 1 if at least one conflict is found, 0 otherwise.
*/
GIT_EXTERN
(
int
)
git_index_has_conflicts
(
git_index
*
index
);
/**@}*/
/**@}*/
/** @name Resolve Undo (REUC) index entry manipulation.
/** @name Resolve Undo (REUC) index entry manipulation.
...
...
src/index.c
View file @
7cc1bf0f
...
@@ -959,6 +959,21 @@ void git_index_conflict_cleanup(git_index *index)
...
@@ -959,6 +959,21 @@ void git_index_conflict_cleanup(git_index *index)
git_vector_remove_matching
(
&
index
->
entries
,
index_conflicts_match
);
git_vector_remove_matching
(
&
index
->
entries
,
index_conflicts_match
);
}
}
int
git_index_has_conflicts
(
git_index
*
index
)
{
unsigned
int
i
;
git_index_entry
*
entry
;
assert
(
index
);
git_vector_foreach
(
&
index
->
entries
,
i
,
entry
)
{
if
(
index_entry_stage
(
entry
)
>
0
)
return
1
;
}
return
0
;
}
unsigned
int
git_index_reuc_entrycount
(
git_index
*
index
)
unsigned
int
git_index_reuc_entrycount
(
git_index
*
index
)
{
{
assert
(
index
);
assert
(
index
);
...
...
tests-clar/index/conflicts.c
View file @
7cc1bf0f
...
@@ -180,8 +180,12 @@ void test_index_conflicts__remove_all_conflicts(void)
...
@@ -180,8 +180,12 @@ void test_index_conflicts__remove_all_conflicts(void)
cl_assert
(
git_index_entrycount
(
repo_index
)
==
8
);
cl_assert
(
git_index_entrycount
(
repo_index
)
==
8
);
cl_assert_equal_i
(
true
,
git_index_has_conflicts
(
repo_index
));
git_index_conflict_cleanup
(
repo_index
);
git_index_conflict_cleanup
(
repo_index
);
cl_assert_equal_i
(
false
,
git_index_has_conflicts
(
repo_index
));
cl_assert
(
git_index_entrycount
(
repo_index
)
==
2
);
cl_assert
(
git_index_entrycount
(
repo_index
)
==
2
);
for
(
i
=
0
;
i
<
git_index_entrycount
(
repo_index
);
i
++
)
{
for
(
i
=
0
;
i
<
git_index_entrycount
(
repo_index
);
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