diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2018-06-30 13:24:23 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-30 13:24:23 +0100 |
commit | c43658f62ee268a0b5ee13f5764544882245063c (patch) | |
tree | 53e16272b69be5f323ce7caf6cf7ce0302773f96 /include | |
parent | 68e73791a9dc955db998e3f4385854aed07cab8b (diff) | |
parent | 243d40df2357620b7fb0c4d10f10d5bf7b67e647 (diff) | |
download | libgit2-c43658f62ee268a0b5ee13f5764544882245063c.tar.gz |
Merge pull request #4536 from libgit2/ethomson/index_dirty
Add a "dirty" state to the index when it has unsaved changes
Diffstat (limited to 'include')
-rw-r--r-- | include/git2/common.h | 11 | ||||
-rw-r--r-- | include/git2/errors.h | 1 |
2 files changed, 11 insertions, 1 deletions
diff --git a/include/git2/common.h b/include/git2/common.h index fc820cae7..8c9347413 100644 --- a/include/git2/common.h +++ b/include/git2/common.h @@ -194,7 +194,8 @@ typedef enum { GIT_OPT_GET_WINDOWS_SHAREMODE, GIT_OPT_SET_WINDOWS_SHAREMODE, GIT_OPT_ENABLE_STRICT_HASH_VERIFICATION, - GIT_OPT_SET_ALLOCATOR + GIT_OPT_SET_ALLOCATOR, + GIT_OPT_ENABLE_UNSAVED_INDEX_SAFETY } git_libgit2_opt_t; /** @@ -363,6 +364,14 @@ typedef enum { * > allocator will then be used to make all memory allocations for * > libgit2 operations. * + * opts(GIT_OPT_ENABLE_UNSAVED_INDEX_SAFETY, int enabled) + * + * > Ensure that there are no unsaved changes in the index before + * > beginning any operation that reloads the index from disk (eg, + * > checkout). If there are unsaved changes, the instruction will + * > fail. (Using the FORCE flag to checkout will still overwrite + * > these changes.) + * * @param option Option key * @param ... value to set the option * @return 0 on success, <0 on failure diff --git a/include/git2/errors.h b/include/git2/errors.h index 6f5580253..00fbed157 100644 --- a/include/git2/errors.h +++ b/include/git2/errors.h @@ -55,6 +55,7 @@ typedef enum { GIT_ITEROVER = -31, /**< Signals end of iteration with iterator */ GIT_RETRY = -32, /**< Internal only */ GIT_EMISMATCH = -33, /**< Hashsum mismatch in object */ + GIT_EINDEXDIRTY = -34, /**< Unsaved changes in the index would be overwritten */ } git_error_code; /** |