summaryrefslogtreecommitdiff
path: root/include/git2
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 /include/git2
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 'include/git2')
-rw-r--r--include/git2/index.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/git2/index.h b/include/git2/index.h
index 1e1d5e748..49bbe1614 100644
--- a/include/git2/index.h
+++ b/include/git2/index.h
@@ -430,6 +430,15 @@ GIT_EXTERN(int) git_index_add(git_index *index, const git_index_entry *source_en
*/
GIT_EXTERN(int) git_index_entry_stage(const git_index_entry *entry);
+/**
+ * Return whether the given index entry is a conflict (has a high stage
+ * entry). This is simply shorthand for `git_index_entry_stage > 0`.
+ *
+ * @param entry The entry
+ * @return 1 if the entry is a conflict entry, 0 otherwise
+ */
+GIT_EXTERN(int) git_index_entry_is_conflict(const git_index_entry *entry);
+
/**@}*/
/** @name Workdir Index Entry Functions