Add a git_libgit2_opts option to set the max indexer object count

This commit is contained in:
Nelson Elhage
2018-07-12 04:20:15 +00:00
parent 912c59c948
commit efe3f37d5f
3 changed files with 30 additions and 11 deletions

View File

@@ -195,7 +195,9 @@ typedef enum {
GIT_OPT_SET_WINDOWS_SHAREMODE,
GIT_OPT_ENABLE_STRICT_HASH_VERIFICATION,
GIT_OPT_SET_ALLOCATOR,
GIT_OPT_ENABLE_UNSAVED_INDEX_SAFETY
GIT_OPT_ENABLE_UNSAVED_INDEX_SAFETY,
GIT_OPT_GET_INDEXER_MAX_OBJECTS,
GIT_OPT_SET_INDEXER_MAX_OBJECTS
} git_libgit2_opt_t;
/**
@@ -372,6 +374,18 @@ typedef enum {
* > fail. (Using the FORCE flag to checkout will still overwrite
* > these changes.)
*
* opts(GIT_OPT_GET_INDEXER_MAX_OBJECTS, size_t *out)
*
* > Get the maximum number of objects libgit2 will allow in a pack
* > file when downloading a pack file from a remote. This can be
* > used to limit maximum memory usage when fetching from an untrusted
* > remote.
*
* opts(GIT_OPT_SET_INDEXER_MAX_OBJECTS, size_t objects)
*
* > Set the maximum number of objects libgit2 will allow in a pack
* > file when downloading a pack file from a remote.
*
* @param option Option key
* @param ... value to set the option
* @return 0 on success, <0 on failure