]>
git.proxmox.com Git - libgit2.git/blob - src/tree.h
2 * Copyright (C) 2009-2012 the libgit2 contributors
4 * This file is part of libgit2, distributed under the GNU GPL v2 with
5 * a Linking Exception. For full terms see the included COPYING file.
7 #ifndef INCLUDE_tree_h__
8 #define INCLUDE_tree_h__
10 #include "git2/tree.h"
11 #include "repository.h"
15 struct git_tree_entry
{
28 struct git_treebuilder
{
32 GIT_INLINE(int) git_tree__dup(git_tree
**dest
, git_tree
*source
)
34 return git_object__dup((git_object
**)dest
, (git_object
*)source
);
37 GIT_INLINE(bool) git_tree_entry__is_tree(const struct git_tree_entry
*e
)
39 return (S_ISDIR(e
->attr
) && !S_ISGITLINK(e
->attr
));
42 void git_tree__free(git_tree
*tree
);
43 int git_tree__parse(git_tree
*tree
, git_odb_object
*obj
);
46 * Lookup the first position in the tree with a given prefix.
48 * @param tree a previously loaded tree.
49 * @param prefix the beginning of a path to find in the tree.
50 * @return index of the first item at or after the given prefix.
52 int git_tree__prefix_position(git_tree
*tree
, const char *prefix
);
56 * Write a tree to the given repository
58 int git_tree__write_index(
59 git_oid
*oid
, git_index
*index
, git_repository
*repo
);
62 * Obsolete mode kept for compatibility reasons
64 #define GIT_FILEMODE_BLOB_GROUP_WRITABLE 0100664