Parser for the git index file format.
Class |
|
A Git Index file. |
Class | locked |
Lock the index while making modifications. |
Exception |
|
An unsupported index format was encountered. |
Exception |
|
Undocumented |
Function | blob |
Create a blob from a path and a stat object. |
Function | blob |
Create a blob from a path and a stat object. |
Function | build |
Build a file or symlink on disk based on a Git object. |
Function | build |
Generate and materialize index from a tree |
Function | changes |
Find the differences between the contents of a tree and a working copy. |
Function | cleanup |
Cleanup a mode value. |
Function | commit |
Create a new tree from an index. |
Function | commit |
Commit a new tree. |
Function | get |
Walk through an index and check for differences against working tree. |
Function | index |
Undocumented |
Function | index |
Create an index from a filesystem path. |
Function | index |
Create a new index entry from a stat value. |
Function | iter |
Iterate over current versions of index entries on disk. |
Function | iter |
Iterate over versions of objects on disk referenced by index. |
Function | pathjoin |
Join a /-delimited path. |
Function | pathsplit |
Split a /-delimited path into a directory part and a basename. |
Function | read |
Read an entry from a cache file. |
Function | read |
Read a cache time. |
Function | read |
Read an index file, yielding the individual entries. |
Function | read |
Read an index file and return it as a dictionary. |
Function | read |
Read the head commit of a submodule. |
Function | refresh |
Refresh the contents of an index. |
Function | symlink |
Undocumented |
Function | validate |
Default path validator that just checks for .git/. |
Function | validate |
Undocumented |
Function | validate |
Undocumented |
Function | write |
Write an index entry to a file. |
Function | write |
Write a cache time. |
Function | write |
Write an index file. |
Function | write |
Write an index file based on the contents of a dictionary. |
Constant | DEFAULT |
Undocumented |
Constant | EXTENDED |
Undocumented |
Constant | EXTENDED |
Undocumented |
Constant | FLAG |
Undocumented |
Constant | FLAG |
Undocumented |
Constant | FLAG |
Undocumented |
Constant | INVALID |
Undocumented |
Variable |
|
Undocumented |
Variable | os |
Undocumented |
Function | _fs |
Convert a file system path to a git tree path. |
Function | _has |
Check if a directory has changed after getting an error. |
Function | _tree |
Convert a git tree path to a file system path. |
Build a file or symlink on disk based on a Git object.
Returns: stat object for the file
Parameters | |
blob:Blob | The git object |
mode:int | File mode |
targetbytes | Path to write to |
honor | An optional flag to honor core.filemode setting in config file, default is core.filemode=True, change executable bit |
tree | Undocumented |
symlink | Undocumented |
symlink | Function to use for creating symlinks |
Generate and materialize index from a tree
- Note: existing index is wiped and contents are not merged
- in a working dir. Suitable only for fresh clones.
Parameters | |
rootUnion[ | Target dir for materialized index files |
indexUnion[ | Target path for generated index |
objectBaseObjectStore | Non-empty object store holding tree contents |
treebytes | Tree to materialize |
honorbool | An optional flag to honor core.filemode setting in config file, default is core.filemode=True, change executable bit |
validate | Function to validate path elements to check out; default just refuses .git and .. directories. |
symlink | Undocumented |
Find the differences between the contents of a tree and a working copy.
- Returns: Iterator over tuples with (oldpath, newpath), (oldmode, newmode),
- (oldsha, newsha)
Parameters | |
names:Iterable[ | Iterable of names in the working copy |
lookupCallable[ | Function to lookup an entry in the working copy |
objectBaseObjectStore | Object store to use for retrieving tree contents |
tree:Optional[ | SHA1 of the root tree, or None for an empty tree |
want | Whether unchanged files should be reported |
Returns | |
Iterable[ | Undocumented |
Create a new tree from an index.
Note: This function is deprecated, use index.commit() instead. Returns: Root tree sha.
Parameters | |
objectBaseObjectStore | Object store to save the tree in |
index:Index | Index file |
Returns | |
bytes | Undocumented |
Create an index from a filesystem path.
This returns an index value for files, symlinks and tree references. for directories and non-existent files it returns None
Returns: An index entry; None for directories
Parameters | |
path:bytes | Path to create an index entry for |
objectOptional[ | Optional object store to save new blobs in |
Returns | |
Optional[ | Undocumented |
Iterate over current versions of index entries on disk.
Returns: Iterator over path, index_entry
Parameters | |
paths:Iterable[ | Paths to iterate over |
rootbytes | Root path to access from |
objectOptional[ | Optional store to save new blobs in |
Returns | |
Iterator[ | Undocumented |
Iterate over versions of objects on disk referenced by index.
Returns: Iterator over path, sha, mode
Parameters | |
paths:Iterable[ | Undocumented |
rootbytes | Root path to access from |
include | Include deleted entries with sha and mode set to None |
object | Optional object store to report new items to |
Returns | |
Iterator[ | Undocumented |
Read an entry from a cache file.
Parameters | |
f | File-like object to read from |
version:int | Undocumented |
Returns | |
tuple with | name, IndexEntry |
Read a cache time.
Parameters | |
f | File-like object to read from |
Returns | |
Tuple with seconds and nanoseconds |
Read an index file and return it as a dictionary.
Parameters | |
f | File object to read from |
Returns | |
Dict[ | Undocumented |
Write an index entry to a file.
Parameters | |
f | File object |
name:bytes | Undocumented |
entry:IndexEntry | IndexEntry to write, tuple with: |
version:int | Undocumented |
Write a cache time.
Parameters | |
f | File-like object to write to |
t | Time to write (as int, float or tuple with secs and nsecs) |
Check if a directory has changed after getting an error.
When handling an error trying to create a blob from a path, call this function. It will check if the path is a directory. If it's a directory and a submodule, check the submodule head to see if it's has changed. If not, consider the file as changed as Git tracked a file and not a directory.
Return true if the given path should be considered as changed and False otherwise or if the path is not a directory.
Parameters | |
treebytes | Undocumented |
entry | Undocumented |