Skip to content

Commit 6e1365b

Browse files
committed
Add tree::entries() method
1 parent 1ce2d85 commit 6e1365b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

include/cppgit2/tree.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,15 @@ class tree : public libgit2_api {
144144
// Number of entries in tree
145145
size_t size() const;
146146

147+
// get a vector of all tree entries
148+
std::vector<entry> entries() {
149+
auto result = std::vector<entry>();
150+
for (long i=0; i < size() ; i++) {
151+
result.push_back(lookup_entry_by_index(i));
152+
}
153+
return result;
154+
}
155+
147156
// Tree traversal modes
148157
enum class traversal_mode { preorder = 0, postorder = 1 };
149158

@@ -211,3 +220,4 @@ class tree : public libgit2_api {
211220
};
212221

213222
} // namespace cppgit2
223+

0 commit comments

Comments
 (0)