datalad_next.iter_collections.gittree
Report on the content of a Git tree-ish
The main functionality is provided by the iter_gittree() function.
- class datalad_next.iter_collections.gittree.GitTreeItem(name: str, gitsha: str | None = None, gittype: GitTreeItemType | None = None)[source]
Bases:
PathBasedItemPathBasedItemwith a relative path as a name (in POSIX conventions)- gitsha: str | None = None
- gittype: GitTreeItemType | None = None
- name: str
- property path: PurePosixPath
Returns the item name as a
PurePosixPathinstance
- class datalad_next.iter_collections.gittree.GitTreeItemType(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
EnumEnumeration of item types of Git trees
- directory = 'directory'
- executablefile = 'executablefile'
- file = 'file'
- submodule = 'submodule'
- symlink = 'symlink'
- datalad_next.iter_collections.gittree.iter_gittree(path: Path, treeish: str, *, recursive: str = 'repository') Generator[GitTreeItem, None, None][source]
Uses
git ls-treeto report on a tree in a Git repository- Parameters:
path (Path) -- Path of a directory in a Git repository to report on. This directory need not be the root directory of the repository, but must be part of the repository. If the directory is not the root directory of a non-bare repository, the iterator is constrained to items underneath that directory.
recursive ({'repository', 'no'}, optional) -- Behavior for recursion into subtrees. By default (
repository), all tree within the repository underneathpath) are reported, but not tree within submodules. Ifno, only direct children are reported on.
- Yields:
GitTreeItem-- Thenameattribute of an item is astrwith the corresponding (relative) path, as reported by Git (in POSIX conventions).