Tree

CLOS class tree
Superclass:

[‘T’]

Metaclass:

standard-class

Method (get-object (class (eq TREE)) (id/name T) (repository T))

Return an object of type CLASS from the object database. The lookup will use either an oid or a name to find the object.

See also: get-object

Listing Contents

Generic (tree-directory tree &optional pathname)
(tree-directory (object TREE) &OPTIONAL PATHNAME)

List objects from a tree. Optional argument pathname a wild pathname that the entries must match.

GIT> (tree-directory
      (commit-tree
       (target
        (repository-head
         (open-repository (merge-pathnames #p"projects/ecl" (user-homedir-pathname)))))))
(#<TREE-BLOB .gitignore (weak) {1007732933}>
 #<TREE-BLOB ANNOUNCEMENT (weak) {1007733AE3}>
 #<TREE-BLOB Copyright (weak) {1007734C53}>
 #<TREE-BLOB INSTALL (weak) {1007735DC3}>
 #<TREE-BLOB LGPL (weak) {1007736F13}>
 #<TREE-BLOB Makefile.in (weak) {10077380D3}>
 #<TREE-BLOB README.1st (weak) {1007739283}>
 #<TREE-BLOB configure (weak) {100773A3F3}>
 #<TREE-TREE contrib/ (weak) {100773B523}>
 #<TREE-TREE examples/ (weak) {100773C683}>
 #<TREE-TREE msvc/ (weak) {100773D7D3}>
 #<TREE-TREE src/ (weak) {100773E8D3}>)

Filtering

In the same way that DIRECTORY can take wildcard pathnames to produce limited list of results.

GIT> (directory (merge-pathnames #p"projects/ecl/co*"
                                 (user-homedir-pathname)))
(#P"/home/russell/projects/ecl/configure"
 #P"/home/russell/projects/ecl/contrib/")

TREE-DIRECTORY can be used to limit the results from the directory tree. Using a wild card will filter the results that are returned. Extending on the example above we can just list a subset of the content with.

GIT> (tree-directory
      (get-tree
       (target
        (repository-head
         (open-repository (merge-pathnames #p"projects/ecl"
                                           (user-homedir-pathname))))))
      #P"co*")
(#<TREE-BLOB configure (weak) {1007C11A23}>
 #<TREE-TREE contrib/ (weak) {1007C130F3}>)