cache-tree.hon commit remote-bzr: reorganize the way 'wanted' works (e56660a)
   1#ifndef CACHE_TREE_H
   2#define CACHE_TREE_H
   3
   4#include "tree.h"
   5#include "tree-walk.h"
   6
   7struct cache_tree;
   8struct cache_tree_sub {
   9        struct cache_tree *cache_tree;
  10        int count;              /* internally used by update_one() */
  11        int namelen;
  12        int used;
  13        char name[FLEX_ARRAY];
  14};
  15
  16struct cache_tree {
  17        int entry_count; /* negative means "invalid" */
  18        unsigned char sha1[20];
  19        int subtree_nr;
  20        int subtree_alloc;
  21        struct cache_tree_sub **down;
  22};
  23
  24struct cache_tree *cache_tree(void);
  25void cache_tree_free(struct cache_tree **);
  26void cache_tree_invalidate_path(struct cache_tree *, const char *);
  27struct cache_tree_sub *cache_tree_sub(struct cache_tree *, const char *);
  28
  29void cache_tree_write(struct strbuf *, struct cache_tree *root);
  30struct cache_tree *cache_tree_read(const char *buffer, unsigned long size);
  31
  32int cache_tree_fully_valid(struct cache_tree *);
  33int cache_tree_update(struct cache_tree *, struct cache_entry **, int, int);
  34
  35int update_main_cache_tree(int);
  36
  37/* bitmasks to write_cache_as_tree flags */
  38#define WRITE_TREE_MISSING_OK 1
  39#define WRITE_TREE_IGNORE_CACHE_TREE 2
  40#define WRITE_TREE_DRY_RUN 4
  41#define WRITE_TREE_SILENT 8
  42
  43/* error return codes */
  44#define WRITE_TREE_UNREADABLE_INDEX (-1)
  45#define WRITE_TREE_UNMERGED_INDEX (-2)
  46#define WRITE_TREE_PREFIX_ERROR (-3)
  47
  48int write_cache_as_tree(unsigned char *sha1, int flags, const char *prefix);
  49void prime_cache_tree(struct cache_tree **, struct tree *);
  50
  51extern int cache_tree_matches_traversal(struct cache_tree *, struct name_entry *ent, struct traverse_info *info);
  52
  53#endif