summaryrefslogtreecommitdiff
path: root/src/index.c
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@microsoft.com>2015-05-19 11:23:59 -0400
committerEdward Thomson <ethomson@microsoft.com>2015-05-28 09:47:31 -0400
commit9f545b9d71c7bd316be80e5fe8b47135e9deb97e (patch)
treed2cf3279b4fd716fcea963a2a0118dd522a52270 /src/index.c
parent2f1080ea04ad1235efcd4b213dbe3a1b847644f7 (diff)
downloadlibgit2-9f545b9d71c7bd316be80e5fe8b47135e9deb97e.tar.gz
introduce `git_index_entry_is_conflict`
It's not always obvious the mapping between stage level and conflict-ness. More importantly, this can lead otherwise sane people to write constructs like `if (!git_index_entry_stage(entry))`, which (while technically correct) is unreadable. Provide a nice method to help avoid such messy thinking.
Diffstat (limited to 'src/index.c')
-rw-r--r--src/index.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/index.c b/src/index.c
index e37cb1f4d..bd65d924b 100644
--- a/src/index.c
+++ b/src/index.c
@@ -1537,7 +1537,7 @@ int git_index_conflict_next(
while (iterator->cur < iterator->index->entries.length) {
entry = git_index_get_byindex(iterator->index, iterator->cur);
- if (git_index_entry_stage(entry) > 0) {
+ if (git_index_entry_is_conflict(entry)) {
if ((len = index_conflict__get_byindex(
ancestor_out,
our_out,
@@ -2383,6 +2383,11 @@ int git_index_entry_stage(const git_index_entry *entry)
return GIT_IDXENTRY_STAGE(entry);
}
+int git_index_entry_is_conflict(const git_index_entry *entry)
+{
+ return (GIT_IDXENTRY_STAGE(entry) > 0);
+}
+
typedef struct read_tree_data {
git_index *index;
git_vector *old_entries;