GgitTree

## GgitTree GgitTree |

## Functions

gint | (*GgitTreeWalkCallback) ()
GgitOId * | ggit_tree_get_id ()
GgitTreeEntry * | ggit_tree_get ()
guint | ggit_tree_size ()
GgitTreeEntry * | ggit_tree_get_by_name ()
GgitTreeEntry * | ggit_tree_get_by_path ()
void | ggit_tree_walk ()

## Types and Values

| GgitTree
struct | GgitTreeClass
enum | GgitTreeWalkMode

## Object Hierarchy

        GEnum
        ╰── GgitTreeWalkMode
        GObject
        ╰── GgitObjectFactoryBase
            ╰── GgitNative
                ╰── GgitObject
                    ╰── GgitTree

## Description

## Functions

### GgitTreeWalkCallback ()

    gint
    (*GgitTreeWalkCallback) (const gchar *root,
                             const GgitTreeEntry *entry,
                             gpointer user_data);

The type of the callback functions for walking a tree. See `ggit_tree_walk()`.

#### Parameters

root | the current (relative) root of the entry |
entry | the tree entry |
user_data | user-supplied data. | [closure]

#### Returns

0 to go for the next entry or a GgitError in case there was an error.

### ggit_tree_get_id ()

    GgitOId *
    ggit_tree_get_id (GgitTree *tree);

Get the GgitOId of the tree.

#### Parameters

tree | a GgitTree. |

#### Returns

a GgitOId.

[transfer full]

### ggit_tree_get ()

    GgitTreeEntry *
    ggit_tree_get (GgitTree *tree,
                   guint i);

Get a tree entry by index.

#### Parameters

tree | a GgitTree. |
i | the index of the entry. |

#### Returns

a GgitTreeEntry.

[transfer full]

### ggit_tree_size ()

    guint
    ggit_tree_size (GgitTree *tree);

Get the number of entries in the tree.

#### Parameters

tree | a GgitTree. |

#### Returns

the number of entries in the tree.

### ggit_tree_get_by_name ()

    GgitTreeEntry *
    ggit_tree_get_by_name (GgitTree *tree,
                           const gchar *name);

Get a tree entry by name.

#### Parameters

tree | a GgitTree. |
name | a filename. |

#### Returns

a GgitTreeEntry.

[transfer full]

### ggit_tree_get_by_path ()

    GgitTreeEntry *
    ggit_tree_get_by_path (GgitTree *tree,
                           const gchar *path,
                           GError **error);

Retrieves a tree entry contained in a tree or in any of its subtrees, given its relative path.

#### Parameters

tree | a GgitTree. |
path | a path. |
error | a GError for error reporting, or `NULL`. |

#### Returns

a GgitTreeEntry.

[transfer full]

### ggit_tree_walk ()

    void
    ggit_tree_walk (GgitTree *tree,
                    GgitTreeWalkMode mode,
                    GgitTreeWalkCallback callback,
                    gpointer user_data,
                    GError **error);

Walk all the entries of a tree object recursively (resolving and walking subtrees of the tree as needed). The `error` will be set to the error returned by `callback` (if any).

#### Parameters

tree | a GgitTree. |
mode | the walking order. |
callback | the callback to call for each entry. | [scope call]
user_data | user data for the callback. | [closure]
error | a GError for error reporting, or `NULL`. |

## Types and Values

### GgitTree

    typedef struct _GgitTree GgitTree;

Represents a tree object.

### struct GgitTreeClass

    struct GgitTreeClass {
    };

The class structure for GgitTreeClass.

#### Members

### enum GgitTreeWalkMode

Describes in which order a tree walk should be performed.

#### Members

GGIT_TREE_WALK_MODE_PRE | walk tree in pre-order |
GGIT_TREE_WALK_MODE_POST | walk tree in post-order |