Settings

classpygit2.Settings

Library-wide settings interface.

cache_max_size(value:int) None

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:int) None

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.

propertycached_memory:tuple[int,int]

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

disable_pack_keep_file_checks(value:bool=True) None

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

enable_caching(value:bool=True) None

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.

enable_fsync_gitdir(value:bool=True) None

Enable or disable fsync for git directory operations

enable_http_expect_continue(value:bool=True) None

Enable or disable HTTP Expect/Continue for large pushes

enable_ofs_delta(value:bool=True) None

Enable or disable offset delta encoding

enable_strict_hash_verification(value:bool=True) None

Enable or disable strict hash verification

enable_strict_object_creation(value:bool=True) None

Enable or disable strict object creation validation

enable_strict_symbolic_ref_creation(value:bool=True) None

Enable or disable strict symbolic reference creation validation

enable_unsaved_index_safety(value:bool=True) None

Enable or disable unsaved index safety checks

propertyextensions:list[str]

Get the list of enabled extensions

propertyhomedir:str|None

Get or set the home directory

propertymwindow_file_limit:int

Get or set the maximum number of files to be mapped at any time

propertymwindow_mapped_limit:int

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

propertymwindow_size:int

Get or set the maximum mmap window size

propertyowner_validation:bool

Get or set repository directory ownership validation

propertypack_max_objects:int

Get or set the maximum number of objects in a pack

propertysearch_path:SearchPathList

Configuration file search path.

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

propertyserver_connect_timeout:int

Get or set the server connection timeout in milliseconds

propertyserver_timeout:int

Get or set the server timeout in milliseconds

set_extensions(extensions:list[str]) None

Set the list of enabled extensions

set_odb_loose_priority(priority:int) None

Set the priority for loose ODB backend (default 2)

set_odb_packed_priority(priority:int) None

Set the priority for packed ODB backend (default 1)

set_ssl_cert_locations(cert_file:str|bytes|None, cert_dir:str|bytes) None
set_ssl_cert_locations(cert_file:str|bytes, cert_dir:str|bytes|None) None

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.

set_ssl_ciphers(ciphers:str|bytes) None

Set the SSL ciphers to use for HTTPS connections

propertyssl_cert_dir:str|bytes|None

TLS certificates lookup directory path.

propertyssl_cert_file:str|bytes|None

TLS certificate file path.

propertytemplate_path:str|None

Get or set the default template path for new repositories

propertyuser_agent:str|None

Get or set the user agent string for network operations

propertyuser_agent_product:str|None

Get or set the user agent product name

propertywindows_sharemode:int

Get or set the Windows share mode for opening files