Enums

pygit2 exposes libgit2 constants as Python enums in the pygit2.enums module. They are preferred over the top-level GIT_* integer constants.

Repository

class pygit2.enums.RepositoryInitFlag(*values)

Option flags for pygit2.init_repository().

BARE = 1

Create a bare repository with no working directory.

EXTERNAL_TEMPLATE = 32

libgit2 normally uses internal templates to initialize a new repo. This flags enables external templates, looking at the “template_path” from the options if set, or the init.templatedir global config if not, or falling back on “/usr/share/git-core/templates” if it exists.

MKDIR = 8

Make the repo_path (and workdir_path) as needed. Init is always willing to create the “.git” directory even without this flag. This flag tells init to create the trailing component of the repo and workdir paths as needed.

MKPATH = 16

Recursively make all components of the repo and workdir paths as necessary.

NO_DOTGIT_DIR = 4

Normally a “/.git/” will be appended to the repo path for non-bare repos (if it is not already there), but passing this flag prevents that behavior.

NO_REINIT = 2

Raise GitError if the path appears to already be a git repository.

If an alternate workdir is specified, use relative paths for the gitdir and core.worktree.

class pygit2.enums.RepositoryInitMode(*values)

Mode options for pygit2.init_repository().

SHARED_ALL = 1535

Use ‘–shared=all’ behavior, adding world readability.

SHARED_GROUP = 1533

Use ‘–shared=group’ behavior, chmod’ing the new repo to be group writable and “g+sx” for sticky group assignment.

SHARED_UMASK = 0

Use permissions configured by umask - the default.

class pygit2.enums.RepositoryOpenFlag(*values)

Option flags for Repository.__init__().

BARE = 4

Open repository as a bare repo regardless of core.bare config, and defer loading config file for faster setup. Unlike git_repository_open_bare, this can follow gitlinks.

CROSS_FS = 2

Unless this flag is set, open will not continue searching across filesystem boundaries (i.e. when st_dev changes from the stat system call). For example, searching in a user’s home directory at “/home/user/source/” will not return “/.git/” as the found repo if “/” is a different filesystem than “/home”.

DEFAULT = 0

Default flags.

FROM_ENV = 16

Find and open a git repository, respecting the environment variables used by the git command-line tools. If set, git_repository_open_ext will ignore the other flags and the ceiling_dirs argument, and will allow a NULL path to use GIT_DIR or search from the current directory. The search for a repository will respect $GIT_CEILING_DIRECTORIES and $GIT_DISCOVERY_ACROSS_FILESYSTEM. The opened repository will respect $GIT_INDEX_FILE, $GIT_NAMESPACE, $GIT_OBJECT_DIRECTORY, and $GIT_ALTERNATE_OBJECT_DIRECTORIES. In the future, this flag will also cause git_repository_open_ext to respect $GIT_WORK_TREE and $GIT_COMMON_DIR; currently, git_repository_open_ext with this flag will error out if either $GIT_WORK_TREE or $GIT_COMMON_DIR is set.

NO_DOTGIT = 8

Do not check for a repository by appending /.git to the start_path; only open the repository if start_path itself points to the git directory.

Only open the repository if it can be immediately found in the start_path. Do not walk up from the start_path looking at parent directories.

class pygit2.enums.RepositoryState(*values)

Repository state: These values represent possible states for the repository to be in, based on the current operation which is ongoing.

References and branches

class pygit2.enums.BranchType(*values)
class pygit2.enums.ReferenceFilter(*values)

Filters for References.iterator().

class pygit2.enums.ReferenceType(*values)

Basic type of any Git reference.

ALL = 3

Bitwise OR of (DIRECT | SYMBOLIC)

DIRECT = 1

A reference that points at an object id

INVALID = 0

Invalid reference

SYMBOLIC = 2

A reference that points at another reference

class pygit2.enums.ResetMode(*values)

Kinds of reset operation.

HARD = 3

MIXED plus changes in working tree discarded

MIXED = 2

SOFT plus reset index to the commit

SOFT = 1

Move the head to the given commit

class pygit2.enums.RevSpecFlag(*values)

Revparse flags. These indicate the intended behavior of the spec passed to Repository.revparse()

MERGE_BASE = 4

The spec used the ‘…’ operator, which invokes special semantics.

RANGE = 2

The spec targeted a range of commits.

SINGLE = 1

The spec targeted a single object.

Objects

class pygit2.enums.ObjectType(*values)
ANY = -2

Object can be any of the following

BLOB = 3

A file revision object.

COMMIT = 1

A commit object.

INVALID = -1

Object is invalid.

OFS_DELTA = 6

A delta, base is given by an offset.

REF_DELTA = 7

A delta, base is given by object id.

TAG = 4

An annotated tag object.

TREE = 2

A tree (directory listing) object.

class pygit2.enums.FileMode(*values)

Diff

class pygit2.enums.DeltaStatus(*values)

What type of change is described by a DiffDelta?

RENAMED and COPIED will only show up if you run find_similar() on the Diff object.

TYPECHANGE only shows up given INCLUDE_TYPECHANGE in the DiffOption option flags (otherwise type changes will be split into ADDED / DELETED pairs).

ADDED = 1

entry does not exist in old version

CONFLICTED = 10

entry in the index is conflicted

COPIED = 5

entry was copied from another old entry

DELETED = 2

entry does not exist in new version

IGNORED = 6

entry is ignored item in workdir

MODIFIED = 3

entry content changed between old and new

RENAMED = 4

entry was renamed between old and new

TYPECHANGE = 8

type of entry changed between old and new

UNMODIFIED = 0

no changes

UNREADABLE = 9

entry is unreadable

UNTRACKED = 7

entry is untracked item in workdir

class pygit2.enums.DiffFind(*values)

Flags to control the behavior of diff rename/copy detection.

BREAK_REWRITES = 32

Actually split large rewrites into delete/add pairs

BREAK_REWRITES_FOR_RENAMES_ONLY = 32768

Do not break rewrites unless they contribute to a rename.

Normally, FIND_AND_BREAK_REWRITES will measure the self- similarity of modified files and split the ones that have changed a lot into a DELETE / ADD pair. Then the sides of that pair will be considered candidates for rename and copy detection.

If you add this flag in and the split pair is not used for an actual rename or copy, then the modified record will be restored to a regular MODIFIED record instead of being split.

FIND_ALL = 255

Turn on all finding features.

FIND_AND_BREAK_REWRITES = 48

Mark rewrites for split and break into delete/add pairs

FIND_BY_CONFIG = 0

Obey diff.renames. Overridden by any other FIND_... flag.

FIND_COPIES = 4

Look for copies? (a la –find-copies).

FIND_COPIES_FROM_UNMODIFIED = 8

Consider UNMODIFIED as copy sources? (–find-copies-harder). For this to work correctly, use INCLUDE_UNMODIFIED when the initial Diff is being generated.

FIND_DONT_IGNORE_WHITESPACE = 8192

Measure similarity including all data

FIND_EXACT_MATCH_ONLY = 16384

Measure similarity only by comparing SHAs (fast and cheap)

FIND_FOR_UNTRACKED = 64

Find renames/copies for UNTRACKED items in working directory. For this to work correctly, use INCLUDE_UNTRACKED when the initial Diff is being generated (and obviously the diff must be against the working directory for this to make sense).

FIND_IGNORE_LEADING_WHITESPACE = 0

Measure similarity ignoring leading whitespace (default)

FIND_IGNORE_WHITESPACE = 4096

Measure similarity ignoring all whitespace

FIND_REMOVE_UNMODIFIED = 65536

Remove any UNMODIFIED deltas after find_similar is done.

Using FIND_COPIES_FROM_UNMODIFIED to emulate the –find-copies-harder behavior requires building a diff with the INCLUDE_UNMODIFIED flag. If you do not want UNMODIFIED records in the final result, pass this flag to have them removed.

FIND_RENAMES = 1

Look for renames? (–find-renames)

FIND_RENAMES_FROM_REWRITES = 2

Consider old side of MODIFIED for renames? (–break-rewrites=N)

FIND_REWRITES = 16

Mark significant rewrites for split (–break-rewrites=/M)

class pygit2.enums.DiffFlag(*values)

Flags for the delta object and the file objects on each side.

These flags are used for both the flags value of the DiffDelta and the flags for the DiffFile objects representing the old and new sides of the delta. Values outside of this public range should be considered reserved for internal or future use.

BINARY = 1

file(s) treated as binary data

EXISTS = 8

file exists at this side of the delta

NOT_BINARY = 2

file(s) treated as text data

VALID_ID = 4

id value is known correct

VALID_SIZE = 16

file size value is known correct

class pygit2.enums.DiffOption(*values)

Flags for diff options. A combination of these flags can be passed in via the flags value in diff_* functions.

DISABLE_PATHSPEC_MATCH = 4096

If the pathspec is set in the diff options, this flags indicates that the paths will be treated as literal paths instead of fnmatch patterns. Each path in the list must either be a full path to a file or a directory. (A trailing slash indicates that the path will _only_ match a directory). If a directory is specified, all children will be included.

ENABLE_FAST_UNTRACKED_DIRS = 16384

When diff finds an untracked directory, to match the behavior of core Git, it scans the contents for IGNORED and UNTRACKED files. If all contents are IGNORED, then the directory is IGNORED; if any contents are not IGNORED, then the directory is UNTRACKED. This is extra work that may not matter in many cases. This flag turns off that scan and immediately labels an untracked directory as UNTRACKED (changing the behavior to not match core Git).

FORCE_BINARY = 2097152

Treat all files as binary, disabling text diffs

FORCE_TEXT = 1048576

Treat all files as text, disabling binary attributes & detection

IGNORE_BLANK_LINES = 524288

Ignore blank lines

IGNORE_CASE = 1024

Use case insensitive filename comparisons

IGNORE_FILEMODE = 256

Ignore file mode changes

IGNORE_SUBMODULES = 512

Treat all submodules as unmodified

IGNORE_WHITESPACE = 4194304

Ignore all whitespace

IGNORE_WHITESPACE_CHANGE = 8388608

Ignore changes in amount of whitespace

IGNORE_WHITESPACE_EOL = 16777216

Ignore whitespace at end of line

INCLUDE_CASECHANGE = 2048

May be combined with IGNORE_CASE to specify that a file that has changed case will be returned as an add/delete pair.

INCLUDE_IGNORED = 2

Include ignored files in the diff

INCLUDE_TYPECHANGE = 64

Normally, a type change between files will be converted into a DELETED record for the old and an ADDED record for the new; this options enabled the generation of TYPECHANGE delta records.

INCLUDE_TYPECHANGE_TREES = 128

Even with INCLUDE_TYPECHANGE, blob->tree changes still generally show as a DELETED blob. This flag tries to correctly label blob->tree transitions as TYPECHANGE records with new_file’s mode set to tree. Note: the tree SHA will not be available.

INCLUDE_UNMODIFIED = 32

Include unmodified files in the diff

INCLUDE_UNREADABLE = 65536

Include unreadable files in the diff

INCLUDE_UNREADABLE_AS_UNTRACKED = 131072

Include unreadable files in the diff

INCLUDE_UNTRACKED = 8

Include untracked files in the diff

INDENT_HEURISTIC = 262144

Use a heuristic that takes indentation and whitespace into account which generally can produce better diffs when dealing with ambiguous diff hunks.

MINIMAL = 536870912

Take extra time to find minimal diff

NORMAL = 0

Normal diff, the default

PATIENCE = 268435456

Use the ‘patience diff’ algorithm

RECURSE_IGNORED_DIRS = 4

Even with INCLUDE_IGNORED, an entire ignored directory will be marked with only a single entry in the diff; this flag adds all files under the directory as IGNORED entries, too.

RECURSE_UNTRACKED_DIRS = 16

Even with INCLUDE_UNTRACKED, an entire untracked directory will be marked with only a single entry in the diff (a la what core Git does in git status); this flag adds all files under untracked directories as UNTRACKED entries, too.

REVERSE = 1

Reverse the sides of the diff

SHOW_BINARY = 1073741824

Include the necessary deflate / delta information so that git-apply can apply given diff information to binary files.

SHOW_UNMODIFIED = 67108864

When generating output, include the names of unmodified files if they are included in the git_diff. Normally these are skipped in the formats that list files (e.g. name-only, name-status, raw). Even with this, these will not be included in patch format.

SHOW_UNTRACKED_CONTENT = 33554432

When generating patch text, include the content of untracked files. This automatically turns on INCLUDE_UNTRACKED but it does not turn on RECURSE_UNTRACKED_DIRS. Add that flag if you want the content of every single UNTRACKED file.

SKIP_BINARY_CHECK = 8192

Disable updating of the binary flag in delta records. This is useful when iterating over a diff if you don’t need hunk and data callbacks and want to avoid having to load file completely.

UPDATE_INDEX = 32768

When diff finds a file in the working directory with stat information different from the index, but the OID ends up being the same, write the correct stat information into the index. Note: without this flag, diff will always leave the index untouched.

class pygit2.enums.DiffStatsFormat(*values)

Formatting options for diff stats

FULL = 1

Full statistics, equivalent of –stat

INCLUDE_SUMMARY = 8

Extended header information such as creations, renames and mode changes, equivalent of –summary

NONE = 0

No stats

NUMBER = 4

Number statistics, equivalent of –numstat

SHORT = 2

Short statistics, equivalent of –shortstat

Status

class pygit2.enums.FileStatus(*values)

Status flags for a single file.

A combination of these values will be returned to indicate the status of a file. Status compares the working directory, the index, and the current HEAD of the repository. The INDEX_… set of flags represents the status of the file in the index relative to the HEAD, and the WT_… set of flags represents the status of the file in the working directory relative to the index.

Checkout

class pygit2.enums.CheckoutNotify(*values)

Checkout notification flags

Checkout will invoke an options notification callback (CheckoutCallbacks.checkout_notify) for certain cases - you pick which ones via CheckoutCallbacks.checkout_notify_flags.

CONFLICT = 1

Invokes checkout on conflicting paths.

DIRTY = 2

Notifies about “dirty” files, i.e. those that do not need an update but no longer match the baseline. Core git displays these files when checkout runs, but won’t stop the checkout.

IGNORED = 16

Notifies about ignored files.

UNTRACKED = 8

Notifies about untracked files.

UPDATED = 4

Sends notification for any file changed.

class pygit2.enums.CheckoutStrategy(*values)
ALLOW_CONFLICTS = 16

Allow checkout to make safe updates even if conflicts are found

CONFLICT_STYLE_DIFF3 = 2097152

Include common ancestor data in diff3 format files for conflicts

CONFLICT_STYLE_MERGE = 1048576

Write normal merge files for conflicts

CONFLICT_STYLE_ZDIFF3 = 2097152

Include common ancestor data in zdiff3 format for conflicts

DISABLE_PATHSPEC_MATCH = 8192

Treat pathspec as simple list of exact match file paths

DONT_OVERWRITE_IGNORED = 524288

Don’t overwrite ignored files that exist in the checkout target

DONT_REMOVE_EXISTING = 4194304

Don’t overwrite existing files or folders

DONT_UPDATE_INDEX = 256

Normally checkout updates index entries as it goes; this stops that. Implies DONT_WRITE_INDEX.

DONT_WRITE_INDEX = 8388608

Normally checkout writes the index upon completion; this prevents that.

DRY_RUN = 16777216

Show what would be done by a checkout. Stop after sending notifications; don’t update the working directory or index.

FORCE = 2

Allow all updates to force working directory to look like index.

Mutually exclusive with SAFE. FORCE takes precedence over SAFE.

NONE = 1073741824

Dry run, no actual updates

NO_REFRESH = 512

Don’t refresh index/config/etc before doing checkout

RECREATE_MISSING = 4

Allow checkout to recreate missing files

REMOVE_IGNORED = 64

Remove ignored files not in index

REMOVE_UNTRACKED = 32

Remove untracked files not in index (that are not ignored)

SAFE = 0

Allow safe updates that cannot overwrite uncommitted data. If the uncommitted changes don’t conflict with the checked out files, the checkout will still proceed, leaving the changes intact.

Mutually exclusive with FORCE. FORCE takes precedence over SAFE.

SKIP_LOCKED_DIRECTORIES = 262144

Ignore directories in use, they will be left empty

SKIP_UNMERGED = 1024

Allow checkout to skip unmerged files

UPDATE_ONLY = 128

Only update existing files, don’t create new ones

USE_OURS = 2048

For unmerged files, checkout stage 2 from index

USE_THEIRS = 4096

For unmerged files, checkout stage 3 from index

Merge

class pygit2.enums.MergeAnalysis(*values)

The results of Repository.merge_analysis indicate the merge opportunities.

FASTFORWARD = 4

The given merge input is a fast-forward from HEAD and no merge needs to be performed. Instead, the client can check out the given merge input.

NONE = 0

No merge is possible. (Unused.)

NORMAL = 1

A “normal” merge; both HEAD and the given merge input have diverged from their common ancestor. The divergent commits must be merged.

UNBORN = 8

The HEAD of the current repository is “unborn” and does not point to a valid commit. No merge can be performed, but the caller may wish to simply set HEAD to the target commit(s).

UP_TO_DATE = 2

All given merge inputs are reachable from HEAD, meaning the repository is up-to-date and no merge needs to be performed.

class pygit2.enums.MergeFavor(*values)

Merge file favor options for Repository.merge instruct the file-level merging functionality how to deal with conflicting regions of the files.

NORMAL = 0

When a region of a file is changed in both branches, a conflict will be recorded in the index so that checkout can produce a merge file with conflict markers in the working directory.

This is the default.

OURS = 1

When a region of a file is changed in both branches, the file created in the index will contain the “ours” side of any conflicting region.

The index will not record a conflict.

THEIRS = 2

When a region of a file is changed in both branches, the file created in the index will contain the “theirs” side of any conflicting region.

The index will not record a conflict.

UNION = 3

When a region of a file is changed in both branches, the file created in the index will contain each unique line from each side, which has the result of combining both files.

The index will not record a conflict.

class pygit2.enums.MergeFileFlag(*values)

File merging flags

ACCEPT_CONFLICTS = 512

Do not produce file conflicts when common regions have changed; keep the conflict markers in the file and accept that as the merge result.

DEFAULT = 0

Defaults

DIFF_MINIMAL = 128

Take extra time to find minimal diff

DIFF_PATIENCE = 64

Use the “patience diff” algorithm

IGNORE_WHITESPACE = 8

Ignore all whitespace

IGNORE_WHITESPACE_CHANGE = 16

Ignore changes in amount of whitespace

IGNORE_WHITESPACE_EOL = 32

Ignore whitespace at end of line

SIMPLIFY_ALNUM = 4

Condense non-alphanumeric regions for simplified diff file

STYLE_DIFF3 = 2

Create diff3-style files

STYLE_MERGE = 1

Create standard conflicted merge files

STYLE_ZDIFF3 = 256

Create zdiff3 (“zealous diff3”)-style files

class pygit2.enums.MergeFlag(*values)

Flags for Repository.merge options. A combination of these flags can be passed in via the flags value.

FAIL_ON_CONFLICT = 2

If a conflict occurs, exit immediately instead of attempting to continue resolving conflicts. The merge operation will raise GitError (GIT_EMERGECONFLICT) and no index will be returned.

FIND_RENAMES = 1

Detect renames that occur between the common ancestor and the “ours” side or the common ancestor and the “theirs” side. This will enable the ability to merge between a modified and renamed file.

NO_RECURSIVE = 8

If the commits being merged have multiple merge bases, do not build a recursive merge base (by merging the multiple merge bases), instead simply use the first base. This flag provides a similar merge base to git-merge-resolve.

SKIP_REUC = 4

Do not write the REUC extension on the generated index.

VIRTUAL_BASE = 16

Treat this merge as if it is to produce the virtual base of a recursive merge. This will ensure that there are no conflicts, any conflicting regions will keep conflict markers in the merge result.

class pygit2.enums.MergePreference(*values)

The user’s stated preference for merges.

FASTFORWARD_ONLY = 2

There is a merge.ff=only configuration setting, suggesting that the user only wants fast-forward merges.

NONE = 0

No configuration was found that suggests a preferred behavior for merge.

NO_FASTFORWARD = 1

There is a merge.ff=false configuration setting, suggesting that the user does not want to allow a fast-forward merge.

Blame

class pygit2.enums.BlameFlag(*values)
FIRST_PARENT = 16

Restrict the search of commits to those reachable following only the first parents.

IGNORE_WHITESPACE = 64

Ignore whitespace differences

NORMAL = 0

Normal blame, the default

TRACK_COPIES_ANY_COMMIT_COPIES = 8

Not yet implemented and reserved for future use (as of libgit2 1.9.0).

TRACK_COPIES_SAME_COMMIT_COPIES = 4

Not yet implemented and reserved for future use (as of libgit2 1.9.0).

TRACK_COPIES_SAME_COMMIT_MOVES = 2

Not yet implemented and reserved for future use (as of libgit2 1.9.0).

TRACK_COPIES_SAME_FILE = 1

Not yet implemented and reserved for future use (as of libgit2 1.9.0).

USE_MAILMAP = 32

Use mailmap file to map author and committer names and email addresses to canonical real names and email addresses. The mailmap will be read from the working directory, or HEAD in a bare repository.

Filters

class pygit2.enums.FilterMode(*values)

Filters are applied in one of two directions: smudging - which is exporting a file from the Git object database to the working directory, and cleaning - which is importing a file from the working directory to the Git object database. These values control which direction of change is being applied.

class pygit2.enums.FilterFlag(*values)

Filter option flags.

ALLOW_UNSAFE = 1

Don’t error for safecrlf violations, allow them to continue.

ATTRIBUTES_FROM_COMMIT = 8

Load attributes from .gitattributes in a given commit. This can only be specified in a git_filter_options.

ATTRIBUTES_FROM_HEAD = 4

Load attributes from .gitattributes in the root of HEAD

NO_SYSTEM_ATTRIBUTES = 2

Don’t load /etc/gitattributes (or the system equivalent)

class pygit2.enums.BlobFilter(*values)
ATTRIBUTES_FROM_COMMIT = 8

Load filters from a .gitattributes file in the specified commit.

ATTRIBUTES_FROM_HEAD = 4

Load filters from a .gitattributes file in the HEAD commit.

CHECK_FOR_BINARY = 1

Do not apply filters to binary files.

NO_SYSTEM_ATTRIBUTES = 2

Filters will not load configuration from the system-wide gitattributes in /etc (or system equivalent).

Attributes

class pygit2.enums.AttrCheck(*values)

Remotes

class pygit2.enums.CredentialType(*values)

Supported credential types. This represents the various types of authentication methods supported by the library.

DEFAULT = 8

An NTLM/Negotiate-based authentication request.

SSH_CUSTOM = 4

An SSH key-based authentication request, with a custom signature

SSH_INTERACTIVE = 16

An SSH interactive authentication request.

SSH_KEY = 2

An SSH key-based authentication request

SSH_MEMORY = 64

An SSH key-based authentication request. Allows credentials to be read from memory instead of files. Note that because of differences in crypto backend support, it might not be functional.

USERNAME = 32

Username-only authentication request. Used as a pre-authentication step if the underlying transport (eg. SSH, with no username in its URL) does not know which username to use.

USERPASS_PLAINTEXT = 1

A vanilla user/password request

class pygit2.enums.FetchPrune(*values)

Acceptable prune settings when fetching.

NO_PRUNE = 2

Force pruning off: always keep the remote branches.

PRUNE = 1

Force pruning on: remove any remote branch in the local repository that does not exist in the remote.

UNSPECIFIED = 0

Use the setting from the configuration

Submodules

class pygit2.enums.SubmoduleIgnore(*values)
ALL = 4

never dirty

DIRTY = 3

only dirty if HEAD moved

NONE = 1

any change or untracked == dirty

UNSPECIFIED = -1

use the submodule’s configuration

UNTRACKED = 2

dirty if tracked files change

class pygit2.enums.SubmoduleStatus(*values)
INDEX_ADDED = 16

in index, not in head (flag available if ignore is not ALL)

INDEX_DELETED = 32

in head, not in index (flag available if ignore is not ALL)

INDEX_MODIFIED = 64

index and head don’t match (flag available if ignore is not ALL)

IN_CONFIG = 4

superproject gitmodules has submodule

IN_HEAD = 1

superproject head contains submodule

IN_INDEX = 2

superproject index contains submodule

IN_WD = 8

superproject workdir has submodule

WD_ADDED = 256

in workdir, not index (flag available if ignore is not ALL)

WD_DELETED = 512

in index, not workdir (flag available if ignore is not ALL)

WD_INDEX_MODIFIED = 2048

submodule workdir index is dirty (flag available if ignore is NONE or UNTRACKED)

WD_MODIFIED = 1024

index and workdir head don’t match (flag available if ignore is not ALL)

WD_UNINITIALIZED = 128

workdir contains empty repository (flag available if ignore is not ALL)

WD_UNTRACKED = 8192

submodule workdir contains untracked files (flag available if ignore is NONE)

WD_WD_MODIFIED = 4096

submodule workdir has modified files (flag available if ignore is NONE or UNTRACKED)

Stash

class pygit2.enums.StashApplyProgress(*values)

Stash apply progression states

ANALYZE_INDEX = 2

The stored index is being analyzed.

ANALYZE_MODIFIED = 3

The modified files are being analyzed.

ANALYZE_UNTRACKED = 4

The untracked and ignored files are being analyzed.

CHECKOUT_MODIFIED = 6

The modified files are being written to disk.

CHECKOUT_UNTRACKED = 5

The untracked files are being written to disk.

DONE = 7

The stash was applied successfully.

LOADING_STASH = 1

Loading the stashed data from the object database.

Revwalk

class pygit2.enums.SortMode(*values)

Flags to specify the sorting which a revwalk should perform.

NONE = 0

Sort the output with the same default method from git: reverse chronological order. This is the default sorting for new walkers.

REVERSE = 4

Iterate through the repository contents in reverse order; this sorting mode can be combined with any of the above.

TIME = 2

Sort the repository contents by commit time; this sorting mode can be combined with TOPOLOGICAL.

TOPOLOGICAL = 1

Sort the repository contents in topological order (no parents before all of its children are shown); this sorting mode can be combined with TIME sorting to produce git’s –date-order`.

class pygit2.enums.DescribeStrategy(*values)

Reference lookup strategy.

These behave like the –tags and –all options to git-describe, namely they say to look for any reference in either refs/tags/ or refs/ respectively.

Apply

class pygit2.enums.ApplyLocation(*values)

Possible application locations for patches

BOTH = 2

Apply the patch to both the working directory and the index. This is the equivalent of git apply –index.

INDEX = 1

Apply the patch to the index, leaving the working directory untouched. This is the equivalent of git apply –cached.

WORKDIR = 0

Apply the patch to the workdir, leaving the index untouched. This is the equivalent of git apply with no location argument.

Library

class pygit2.enums.Feature(*values)

Combinations of these values describe the features with which libgit2 was compiled.

class pygit2.enums.Option(*values)

Global libgit2 library options

class pygit2.enums.ConfigLevel(*values)

Priority level of a config file. These priority levels correspond to the natural escalation logic (from higher to lower) when searching for config entries in git.git.

APP = 7

Application specific configuration file; freely defined by applications

GLOBAL = 4

User-specific configuration file (also called Global configuration file); typically ~/.gitconfig

HIGHEST_LEVEL = -1

Represents the highest level available config file (i.e. the most specific config file available that actually is loaded)

LOCAL = 5

Repository specific configuration file; $WORK_DIR/.git/config on non-bare repos

PROGRAMDATA = 1

System-wide on Windows, for compatibility with portable git

SYSTEM = 2

System-wide configuration file; /etc/gitconfig on Linux systems

WORKTREE = 6

Worktree specific configuration file; $GIT_DIR/config.worktree

XDG = 3

XDG compatible configuration file; typically ~/.config/git/config