readTree
Read a tree object directly
| param | type [= default] | description |
|---|---|---|
| core | string = 'default' | The plugin core identifier to use for plugin injection |
| fs [deprecated] | FileSystem | The filesystem containing the git repo. Overrides the fs provided by the plugin system. |
| dir | string | The working tree directory path |
| gitdir | string = join(dir,'.git') | The git directory path |
| oid | string | The SHA-1 object id to get. Annotated tags and commits are peeled. |
| filepath | string | Don't return the object with oid itself, but resolve oid to a tree and then return the tree object at that filepath. |
| return | Promise<ReadTreeResult> | Resolves successfully with a git tree object |
The object returned has the following schema:
type ReadTreeResult = {
oid: string; // SHA-1 object id of this tree
tree: TreeObject; // the parsed tree object
}
type TreeObject = Array<TreeEntry>;
type TreeEntry = {
mode: string; // the 6 digit hexadecimal mode
path: string; // the name of the file or directory
oid: string; // the SHA-1 object id of the blob or tree
type: 'commit' | 'blob' | 'tree'; // the type of object
}