THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

Git Source Code Mirror - This is a publish-only repository and all pull requests are ignored. Please follow Documentation/SubmittingPatches procedure for any of your improvements.
git
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 lines
2.1KB

  1. #ifndef CACHE_TREE_H
  2. #define CACHE_TREE_H
  3. #include "cache.h"
  4. #include "tree.h"
  5. #include "tree-walk.h"
  6. struct cache_tree;
  7. struct cache_tree_sub {
  8. struct cache_tree *cache_tree;
  9. int count; /* internally used by update_one() */
  10. int namelen;
  11. int used;
  12. char name[FLEX_ARRAY];
  13. };
  14. struct cache_tree {
  15. int entry_count; /* negative means "invalid" */
  16. struct object_id oid;
  17. int subtree_nr;
  18. int subtree_alloc;
  19. struct cache_tree_sub **down;
  20. };
  21. struct cache_tree *cache_tree(void);
  22. void cache_tree_free(struct cache_tree **);
  23. void cache_tree_invalidate_path(struct index_state *, const char *);
  24. struct cache_tree_sub *cache_tree_sub(struct cache_tree *, const char *);
  25. void cache_tree_write(struct strbuf *, struct cache_tree *root);
  26. struct cache_tree *cache_tree_read(const char *buffer, unsigned long size);
  27. int cache_tree_fully_valid(struct cache_tree *);
  28. int cache_tree_update(struct index_state *, int);
  29. void cache_tree_verify(struct repository *, struct index_state *);
  30. /* bitmasks to write_index_as_tree flags */
  31. #define WRITE_TREE_MISSING_OK 1
  32. #define WRITE_TREE_IGNORE_CACHE_TREE 2
  33. #define WRITE_TREE_DRY_RUN 4
  34. #define WRITE_TREE_SILENT 8
  35. #define WRITE_TREE_REPAIR 16
  36. /* error return codes */
  37. #define WRITE_TREE_UNREADABLE_INDEX (-1)
  38. #define WRITE_TREE_UNMERGED_INDEX (-2)
  39. #define WRITE_TREE_PREFIX_ERROR (-3)
  40. struct tree* write_in_core_index_as_tree(struct repository *repo);
  41. int write_index_as_tree(struct object_id *oid, struct index_state *index_state, const char *index_path, int flags, const char *prefix);
  42. void prime_cache_tree(struct repository *, struct index_state *, struct tree *);
  43. int cache_tree_matches_traversal(struct cache_tree *, struct name_entry *ent, struct traverse_info *info);
  44. #ifdef USE_THE_INDEX_COMPATIBILITY_MACROS
  45. static inline int write_cache_as_tree(struct object_id *oid, int flags, const char *prefix)
  46. {
  47. return write_index_as_tree(oid, &the_index, get_index_file(), flags, prefix);
  48. }
  49. static inline int update_main_cache_tree(int flags)
  50. {
  51. if (!the_index.cache_tree)
  52. the_index.cache_tree = cache_tree();
  53. return cache_tree_update(&the_index, flags);
  54. }
  55. #endif
  56. #endif