diff options
| author | Romain Geissler <romain.geissler@gmail.com> | 2011-06-06 17:14:30 +0200 |
|---|---|---|
| committer | Romain Geissler <romain.geissler@gmail.com> | 2011-06-06 17:14:30 +0200 |
| commit | ff9a4c130d09629af86a90ac64a89198faf4ffd8 (patch) | |
| tree | 60f932b356c7c1487cc534d25ac5b89f84f54b74 /src/tree.c | |
| parent | f9213015fddb8636daa993080cbbec70a02cba5c (diff) | |
| download | libgit2-ff9a4c130d09629af86a90ac64a89198faf4ffd8.tar.gz | |
Tree: Added a function that returns the type of a tree entry.
Diffstat (limited to 'src/tree.c')
| -rw-r--r-- | src/tree.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/tree.c b/src/tree.c index 60413e276..d539f83e2 100644 --- a/src/tree.c +++ b/src/tree.c @@ -100,6 +100,18 @@ const git_oid *git_tree_entry_id(const git_tree_entry *entry) return &entry->oid; } +git_otype git_tree_entry_type(const git_tree_entry *entry) +{ + assert(entry); + + if (S_ISGITLINK(entry->attr)) + return GIT_OBJ_COMMIT; + else if (S_ISDIR(entry->attr)) + return GIT_OBJ_TREE; + else + return GIT_OBJ_BLOB; +} + int git_tree_entry_2object(git_object **object_out, git_repository *repo, const git_tree_entry *entry) { assert(entry && object_out); |
