diff options
Diffstat (limited to 'src/tree.h')
-rw-r--r-- | src/tree.h | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/tree.h b/src/tree.h index f993cea9f..498a90d66 100644 --- a/src/tree.h +++ b/src/tree.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2011 the libgit2 contributors + * Copyright (C) 2009-2012 the libgit2 contributors * * This file is part of libgit2, distributed under the GNU GPL v2 with * a Linking Exception. For full terms see the included COPYING file. @@ -30,12 +30,22 @@ struct git_treebuilder { }; -GIT_INLINE(unsigned int) entry_is_tree(const struct git_tree_entry *e) +GIT_INLINE(bool) git_tree_entry__is_tree(const struct git_tree_entry *e) { - return e->attr & 040000; + return (S_ISDIR(e->attr) && !S_ISGITLINK(e->attr)); } void git_tree__free(git_tree *tree); int git_tree__parse(git_tree *tree, git_odb_object *obj); +/** + * Lookup the first position in the tree with a given prefix. + * + * @param tree a previously loaded tree. + * @param prefix the beginning of a path to find in the tree. + * @return index of the first item at or after the given prefix. + */ +int git_tree__prefix_position(git_tree *tree, const char *prefix); + + #endif |