🌐 AI搜索 & 代理 主页
blob: faae88be63c2ce012c700af3a88e02e165982a4e [file] [log] [blame]
Junio C Hamano74986462006-04-23 23:52:201#ifndef CACHE_TREE_H
2#define CACHE_TREE_H
3
Junio C Hamanob9d37a52009-04-20 10:58:184#include "tree.h"
Junio C Hamanob65982b2009-05-20 22:57:225#include "tree-walk.h"
Junio C Hamanob9d37a52009-04-20 10:58:186
Junio C Hamano74986462006-04-23 23:52:207struct cache_tree;
8struct cache_tree_sub {
9 struct cache_tree *cache_tree;
Nguyễn Thái Ngọc Duy3cf773e2012-12-16 04:15:2710 int count; /* internally used by update_one() */
Junio C Hamano74986462006-04-23 23:52:2011 int namelen;
12 int used;
13 char name[FLEX_ARRAY];
14};
15
16struct cache_tree {
17 int entry_count; /* negative means "invalid" */
brian m. carlsone0a92802017-05-01 02:28:5618 struct object_id oid;
Junio C Hamano74986462006-04-23 23:52:2019 int subtree_nr;
20 int subtree_alloc;
21 struct cache_tree_sub **down;
22};
23
24struct cache_tree *cache_tree(void);
Junio C Hamanobad68ec2006-04-25 04:18:5825void cache_tree_free(struct cache_tree **);
Nguyễn Thái Ngọc Duya5400ef2014-06-13 12:19:3126void cache_tree_invalidate_path(struct index_state *, const char *);
Junio C Hamano7927a552006-04-27 08:33:0727struct cache_tree_sub *cache_tree_sub(struct cache_tree *, const char *);
Junio C Hamano74986462006-04-23 23:52:2028
Derrick Stoleec80dd392021-01-23 19:58:1329int cache_tree_subtree_pos(struct cache_tree *it, const char *path, int pathlen);
30
Pierre Habouzit1dffb8f2007-09-25 08:22:4431void cache_tree_write(struct strbuf *, struct cache_tree *root);
Junio C Hamanobad68ec2006-04-25 04:18:5832struct cache_tree *cache_tree_read(const char *buffer, unsigned long size);
Junio C Hamano74986462006-04-23 23:52:2033
Junio C Hamanobad68ec2006-04-25 04:18:5834int cache_tree_fully_valid(struct cache_tree *);
Nguyễn Thái Ngọc Duyd0cfc3e2014-06-13 12:19:3235int cache_tree_update(struct index_state *, int);
Nguyễn Thái Ngọc Duyc207e9e2018-11-10 05:49:0236void cache_tree_verify(struct repository *, struct index_state *);
Thomas Rast996277c2011-12-06 17:43:3737
Elijah Newren724dd762019-08-17 18:41:3238/* bitmasks to write_index_as_tree flags */
Junio C Hamanod11b8d32009-05-20 18:04:3539#define WRITE_TREE_MISSING_OK 1
40#define WRITE_TREE_IGNORE_CACHE_TREE 2
Nguyễn Thái Ngọc Duye859c692012-01-16 02:36:4641#define WRITE_TREE_DRY_RUN 4
42#define WRITE_TREE_SILENT 8
David Turneraecf5672014-07-06 04:06:5643#define WRITE_TREE_REPAIR 16
Junio C Hamanod11b8d32009-05-20 18:04:3544
45/* error return codes */
Junio C Hamano45525bd2008-01-11 06:49:3546#define WRITE_TREE_UNREADABLE_INDEX (-1)
47#define WRITE_TREE_UNMERGED_INDEX (-2)
48#define WRITE_TREE_PREFIX_ERROR (-3)
49
Elijah Newren724dd762019-08-17 18:41:3250struct tree* write_in_core_index_as_tree(struct repository *repo);
brian m. carlsonfc5cb992018-03-12 02:27:2351int write_index_as_tree(struct object_id *oid, struct index_state *index_state, const char *index_path, int flags, const char *prefix);
Nguyễn Thái Ngọc Duyc207e9e2018-11-10 05:49:0252void prime_cache_tree(struct repository *, struct index_state *, struct tree *);
Junio C Hamanob9d37a52009-04-20 10:58:1853
Nguyễn Thái Ngọc Duy9ab34f92018-06-30 09:20:2354int cache_tree_matches_traversal(struct cache_tree *, struct name_entry *ent, struct traverse_info *info);
Junio C Hamano74986462006-04-23 23:52:2055#endif