summaryrefslogtreecommitdiff
path: root/include/git2
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2017-04-21 07:31:56 +0000
committerPatrick Steinhardt <ps@pks.im>2017-04-28 14:05:45 +0200
commit35079f507b5287a2a4726cae7753439f753453e2 (patch)
tree65ead793083b46ad4a813d1b488a6f01af451c87 /include/git2
parent28a0741f1ae6f5e1261c8e73854dda69e7a61067 (diff)
downloadlibgit2-35079f507b5287a2a4726cae7753439f753453e2.tar.gz
odb: add option to turn off hash verification
Verifying hashsums of objects we are reading from the ODB may be costly as we have to perform an additional hashsum calculation on the object. Especially when reading large objects, the penalty can be as high as 35%, as can be seen when executing the equivalent of `git cat-file` with and without verification enabled. To mitigate for this, we add a global option for libgit2 which enables the developer to turn off the verification, e.g. when he can be reasonably sure that the objects on disk won't be corrupted.
Diffstat (limited to 'include/git2')
-rw-r--r--include/git2/common.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/git2/common.h b/include/git2/common.h
index 6d2092028..d83e8c3a0 100644
--- a/include/git2/common.h
+++ b/include/git2/common.h
@@ -182,6 +182,7 @@ typedef enum {
GIT_OPT_ENABLE_SYNCHRONOUS_OBJECT_CREATION,
GIT_OPT_GET_WINDOWS_SHAREMODE,
GIT_OPT_SET_WINDOWS_SHAREMODE,
+ GIT_OPT_ENABLE_STRICT_HASH_VERIFICATION,
} git_libgit2_opt_t;
/**
@@ -337,6 +338,13 @@ typedef enum {
* > is written to permanent storage, not simply cached. This
* > defaults to disabled.
*
+ * opts(GIT_OPT_ENABLE_STRICT_HASH_VERIFICATION, int enabled)
+ *
+ * > Enable strict verification of object hashsums when reading
+ * > objects from disk. This may impact performance due to an
+ * > additional checksum calculation on each object. This defaults
+ * > to enabled.
+ *
* @param option Option key
* @param ... value to set the option
* @return 0 on success, <0 on failure