Settings

class pygit2.Settings

Library-wide settings interface.

cache_max_size(value)

Set the maximum total data size that will be cached in memory across all repositories before libgit2 starts evicting objects from the cache. This is a soft limit, in that the library might briefly exceed it, but will start aggressively evicting objects from cache when that happens. The default cache size is 256MB.

cache_object_limit(object_type: ObjectType, value)

Set the maximum data size for the given type of object to be considered eligible for caching in memory. Setting to value to zero means that that type of object will not be cached. Defaults to 0 for enums.ObjectType.BLOB (i.e. won’t cache blobs) and 4k for COMMIT, TREE, and TAG.

property cached_memory

Get the current bytes in cache and the maximum that would be allowed in the cache.

disable_pack_keep_file_checks(value=True)

This will cause .keep file existence checks to be skipped when accessing packfiles, which can help performance with remote filesystems.

enable_caching(value=True)

Enable or disable caching completely.

Because caches are repository-specific, disabling the cache cannot immediately clear all cached objects, but each cache will be cleared on the next attempt to update anything in it.

property mwindow_mapped_limit

Get or set the maximum memory that will be mapped in total by the library

property mwindow_size

Get or set the maximum mmap window size

property search_path

Configuration file search path.

This behaves like an array whose indices correspond to ConfigLevel values. The local search path cannot be changed.

set_ssl_cert_locations(cert_file, cert_dir)

Set the SSL certificate-authority locations.

  • cert_file is the location of a file containing several certificates concatenated together.

  • cert_dir is the location of a directory holding several certificates, one per file.

Either parameter may be NULL, but not both.

property ssl_cert_dir

TLS certificates lookup directory path.

property ssl_cert_file

TLS certificate file path.