]>
Commit | Line | Data |
---|---|---|
b4171320 | 1 | /* |
359fc2d2 | 2 | * Copyright (C) the libgit2 contributors. All rights reserved. |
b4171320 CMN |
3 | * |
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. | |
6 | */ | |
7 | ||
8 | #ifndef INCLUDE_tree_cache_h__ | |
9 | #define INCLUDE_tree_cache_h__ | |
10 | ||
11 | #include "common.h" | |
19c88310 | 12 | #include "pool.h" |
c2f8b215 | 13 | #include "buffer.h" |
b4171320 CMN |
14 | #include "git2/oid.h" |
15 | ||
46bb0067 | 16 | typedef struct git_tree_cache { |
b4171320 CMN |
17 | struct git_tree_cache **children; |
18 | size_t children_count; | |
19 | ||
c2f8b215 | 20 | ssize_t entry_count; |
b4171320 | 21 | git_oid oid; |
1fa17b5c | 22 | size_t namelen; |
b183ffe7 | 23 | char name[GIT_FLEX_ARRAY]; |
06280457 | 24 | } git_tree_cache; |
b4171320 | 25 | |
c2f8b215 | 26 | int git_tree_cache_write(git_buf *out, git_tree_cache *tree); |
19c88310 | 27 | int git_tree_cache_read(git_tree_cache **tree, const char *buffer, size_t buffer_size, git_pool *pool); |
69bffab9 | 28 | void git_tree_cache_invalidate_path(git_tree_cache *tree, const char *path); |
3ba69ba8 | 29 | const git_tree_cache *git_tree_cache_get(const git_tree_cache *tree, const char *path); |
46bb0067 | 30 | int git_tree_cache_new(git_tree_cache **out, const char *name, git_pool *pool); |
6843cebe CMN |
31 | /** |
32 | * Read a tree as the root of the tree cache (like for `git read-tree`) | |
33 | */ | |
34 | int git_tree_cache_read_tree(git_tree_cache **out, const git_tree *tree, git_pool *pool); | |
b4171320 CMN |
35 | void git_tree_cache_free(git_tree_cache *tree); |
36 | ||
37 | #endif |