General

Top level constants and exceptions from the library.

Version

The following constants provide information about the version of the libgit2library that has been built against. The version number has aMAJOR.MINOR.REVISION format.

  • LIBGIT2_VER_MAJOR
  • Integer value of the major version number. For example, for the version0.26.0:
  1. >>> print(pygit2.LIBGIT2_VER_MAJOR)
  2. 0
  • LIBGIT2_VER_MINOR
  • Integer value of the minor version number. For example, for the version0.26.0:
  1. >>> print(pygit2.LIBGIT2_VER_MINOR)
  2. 26
  • LIBGIT2_VER_REVISION
  • Integer value of the revision version number. For example, for the version0.26.0:
  1. >>> print(pygit2.LIBGIT2_VER_REVISION)
  2. 0
  • LIBGIT2_VER
  • Tuple value of the revision version numbers. For example, for the version0.26.0:
  1. >>> print(pygit2.LIBGIT2_VER)
  2. (0, 26, 0)
  • LIBGIT2_VERSION
  • The libgit2 version number as a string:
  1. >>> print(pygit2.LIBGIT2_VERSION)
  2. '0.26.0'

Options

  • pygit2.option(option, )
  • Get or set a libgit2 option.

Parameters:

  • GIT_OPT_GET_SEARCH_PATH, level
  • Get the config search path for the given level.
  • GIT_OPT_SET_SEARCH_PATH, level, path
  • Set the config search path for the given level.
  • GIT_OPT_GET_MWINDOW_SIZE
  • Get the maximum mmap window size.
  • GIT_OPT_SET_MWINDOW_SIZE, size
  • Set the maximum mmap window size.

Exceptions

  • exception pygit2.GitError
  • Bases: Exception

  • exception pygit2.AlreadyExistsError

  • Bases: ValueError

Exception when trying to create an object (reference, etc) that already exists.

  • exception pygit2.InvalidSpecError
  • Bases: ValueError

Exception when an input specification such as a reference name is invalid.