diff options
| author | Carlos Martín Nieto <cmn@dwim.me> | 2015-05-28 18:45:57 +0200 |
|---|---|---|
| committer | Carlos Martín Nieto <cmn@dwim.me> | 2015-05-28 18:45:57 +0200 |
| commit | ff8d635adbf1208927c7319178d29b0ed973a107 (patch) | |
| tree | 329dd098bfefdadf9115c4fa4cff4beddd67c696 /include/git2 | |
| parent | fb92b48d541edde845e8cde176152f13592db71b (diff) | |
| parent | 9b3e41f72bd9ab62e8d129713755c3a3a71359bc (diff) | |
| download | libgit2-ff8d635adbf1208927c7319178d29b0ed973a107.tar.gz | |
Merge pull request #3139 from ethomson/diff_conflicts
Include conflicts when diffing
Diffstat (limited to 'include/git2')
| -rw-r--r-- | include/git2/diff.h | 22 | ||||
| -rw-r--r-- | include/git2/index.h | 12 | ||||
| -rw-r--r-- | include/git2/status.h | 1 |
3 files changed, 24 insertions, 11 deletions
diff --git a/include/git2/diff.h b/include/git2/diff.h index cac3b268a..c0d42e30e 100644 --- a/include/git2/diff.h +++ b/include/git2/diff.h @@ -226,6 +226,7 @@ typedef enum { GIT_DIFF_FLAG_BINARY = (1u << 0), /**< file(s) treated as binary data */ GIT_DIFF_FLAG_NOT_BINARY = (1u << 1), /**< file(s) treated as text data */ GIT_DIFF_FLAG_VALID_ID = (1u << 2), /**< `id` value is known correct */ + GIT_DIFF_FLAG_EXISTS = (1u << 3), /**< file exists at this side of the delta */ } git_diff_flag_t; /** @@ -239,16 +240,17 @@ typedef enum { * DELETED pairs). */ typedef enum { - GIT_DELTA_UNMODIFIED = 0, /**< no changes */ - GIT_DELTA_ADDED = 1, /**< entry does not exist in old version */ - GIT_DELTA_DELETED = 2, /**< entry does not exist in new version */ - GIT_DELTA_MODIFIED = 3, /**< entry content changed between old and new */ - GIT_DELTA_RENAMED = 4, /**< entry was renamed between old and new */ - GIT_DELTA_COPIED = 5, /**< entry was copied from another old entry */ - GIT_DELTA_IGNORED = 6, /**< entry is ignored item in workdir */ - GIT_DELTA_UNTRACKED = 7, /**< entry is untracked item in workdir */ - GIT_DELTA_TYPECHANGE = 8, /**< type of entry changed between old and new */ - GIT_DELTA_UNREADABLE = 9, /**< entry is unreadable */ + GIT_DELTA_UNMODIFIED = 0, /**< no changes */ + GIT_DELTA_ADDED = 1, /**< entry does not exist in old version */ + GIT_DELTA_DELETED = 2, /**< entry does not exist in new version */ + GIT_DELTA_MODIFIED = 3, /**< entry content changed between old and new */ + GIT_DELTA_RENAMED = 4, /**< entry was renamed between old and new */ + GIT_DELTA_COPIED = 5, /**< entry was copied from another old entry */ + GIT_DELTA_IGNORED = 6, /**< entry is ignored item in workdir */ + GIT_DELTA_UNTRACKED = 7, /**< entry is untracked item in workdir */ + GIT_DELTA_TYPECHANGE = 8, /**< type of entry changed between old and new */ + GIT_DELTA_UNREADABLE = 9, /**< entry is unreadable */ + GIT_DELTA_CONFLICTED = 10, /**< entry in the index is conflicted */ } git_delta_t; /** diff --git a/include/git2/index.h b/include/git2/index.h index 52032f7fd..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 @@ -631,7 +640,8 @@ GIT_EXTERN(int) git_index_find(size_t *at_pos, git_index *index, const char *pat /**@{*/ /** - * Add or update index entries to represent a conflict + * Add or update index entries to represent a conflict. Any staged + * entries that exist at the given paths will be removed. * * The entries are the entries from the tree included in the merge. Any * entry may be null to indicate that that file was not present in the diff --git a/include/git2/status.h b/include/git2/status.h index 5f211810d..671113955 100644 --- a/include/git2/status.h +++ b/include/git2/status.h @@ -46,6 +46,7 @@ typedef enum { GIT_STATUS_WT_UNREADABLE = (1u << 12), GIT_STATUS_IGNORED = (1u << 14), + GIT_STATUS_CONFLICTED = (1u << 15), } git_status_t; /** |
