| 1 |
|
| /* |
| 2 |
|
| * Copyright (C) the libgit2 contributors. All rights reserved. |
| 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 |
|
| #ifndef INCLUDE_tree_h__ |
| 8 |
|
| #define INCLUDE_tree_h__ |
| 9 |
|
| |
| 10 |
|
| #include "common.h" |
| 11 |
|
| |
| 12 |
|
| #include "git2/tree.h" |
| 13 |
|
| #include "repository.h" |
| 14 |
|
| #include "odb.h" |
| 15 |
|
| #include "vector.h" |
| 16 |
|
| #include "strmap.h" |
| 17 |
|
| #include "pool.h" |
| 18 |
|
| |
| 19 |
|
| struct git_tree_entry { |
| 20 |
|
| uint16_t attr; |
| 21 |
|
| uint16_t filename_len; |
| 22 |
|
| git_oid oid; |
| 23 |
|
| const char *filename; |
| 24 |
|
| }; |
| 25 |
|
| |
| 26 |
|
| struct git_tree { |
| 27 |
|
| git_object object; |
| 28 |
|
| git_odb_object *odb_obj; |
| 29 |
|
| git_array_t(git_tree_entry) entries; |
| 30 |
|
| }; |
| 31 |
|
| |
| 32 |
|
| struct git_treebuilder { |
| 33 |
|
| git_repository *repo; |
| 34 |
|
| git_strmap *map; |
| 35 |
|
| git_str write_cache; |
| 36 |
|
| }; |
| 37 |
|
| |
| 38 |
2020 |
| GIT_INLINE(bool) git_tree_entry__is_tree(const struct git_tree_entry *e) |
| 39 |
|
| { |
| 40 |
2020 |
▶ | return (S_ISDIR(e->attr) && !S_ISGITLINK(e->attr)); |
Branch: 2 branches
| Branch | True | False | Total |
| return (S_ISDIR(e->attr) && !S_ISGITLINK(e->attr)); |
786 |
1234 |
2020 |
| return (S_ISDIR(e->attr) && !S_ISGITLINK(e->attr)); |
786 |
0 |
786 |
|
| 41 |
|
| } |
| 42 |
|
| |
| 43 |
|
| void git_tree__free(void *tree); |
| 44 |
|
| int git_tree__parse(void *tree, git_odb_object *obj); |
| 45 |
|
| int git_tree__parse_raw(void *_tree, const char *data, size_t size); |
| 46 |
|
| |
| 47 |
|
| /** |
| 48 |
|
| * Write a tree to the given repository |
| 49 |
|
| */ |
| 50 |
|
| int git_tree__write_index( |
| 51 |
|
| git_oid *oid, git_index *index, git_repository *repo); |
| 52 |
|
| |
| 53 |
|
| /** |
| 54 |
|
| * Obsolete mode kept for compatibility reasons |
| 55 |
|
| */ |
| 56 |
|
| #define GIT_FILEMODE_BLOB_GROUP_WRITABLE 0100664 |
| 57 |
|
| |
| 58 |
|
| #endif |