diff options
author | Edward Thomson <ethomson@microsoft.com> | 2015-09-29 15:49:16 -0400 |
---|---|---|
committer | Edward Thomson <ethomson@microsoft.com> | 2015-09-30 09:06:09 -0400 |
commit | 21515f228b739a3ecd2237bafbba50e8d219d8dd (patch) | |
tree | edfbd52eee693f03e4e5248b05c74d45e48fa02d /include/git2/index.h | |
parent | 10df661b8cd2a7e4751f8344633825dfc88be169 (diff) | |
download | libgit2-21515f228b739a3ecd2237bafbba50e8d219d8dd.tar.gz |
index: also try conflict mode when inserting
When we do not trust the on-disk mode, we use the mode of an existing
index entry. This allows us to preserve executable bits on platforms
that do not honor them on the filesystem.
If there is no stage 0 index entry, also look at conflicts to attempt
to answer this question: prefer the data from the 'ours' side, then
the 'theirs' side before falling back to the common ancestor.
Diffstat (limited to 'include/git2/index.h')
-rw-r--r-- | include/git2/index.h | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/include/git2/index.h b/include/git2/index.h index 176ba301e..466765be3 100644 --- a/include/git2/index.h +++ b/include/git2/index.h @@ -154,13 +154,27 @@ typedef enum { GIT_INDEX_ADD_CHECK_PATHSPEC = (1u << 2), } git_index_add_option_t; -/** - * Match any index stage. - * - * Some index APIs take a stage to match; pass this value to match - * any entry matching the path regardless of stage. - */ -#define GIT_INDEX_STAGE_ANY -1 +typedef enum { + /** + * Match any index stage. + * + * Some index APIs take a stage to match; pass this value to match + * any entry matching the path regardless of stage. + */ + GIT_INDEX_STAGE_ANY = -1, + + /** A normal staged file in the index. */ + GIT_INDEX_STAGE_NORMAL = 0, + + /** The ancestor side of a conflict. */ + GIT_INDEX_STAGE_ANCESTOR = 1, + + /** The "ours" side of a conflict. */ + GIT_INDEX_STAGE_OURS = 2, + + /** The "theirs" side of a conflict. */ + GIT_INDEX_STAGE_THEIRS = 3, +} git_index_stage_t; /** @name Index File Functions * |