summaryrefslogtreecommitdiff
path: root/cache-tree.h
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-04-23 16:52:20 -0700
committerJunio C Hamano <junkio@cox.net>2006-04-23 20:18:16 -0700
commit749864627c2d3c33bbc56d7ba0b5542af698cc40 (patch)
tree0226b75892c3b971257c0f62555106c7028d9ea4 /cache-tree.h
parent1af1c2b63db6a413fbeb9b08cd55dcb735d7597d (diff)
downloadgit-749864627c2d3c33bbc56d7ba0b5542af698cc40.tar.gz
Add cache-tree.
The cache_tree data structure is to cache tree object names that would result from the current index file. The idea is to have an optional file to record each tree object name that corresponds to a directory path in the cache when we run write_cache(), and read it back when we run read_cache(). During various index manupulations, we selectively invalidate the parts so that the next write-tree can bypass regenerating tree objects for unchanged parts of the directory hierarchy. We could perhaps make the cache-tree data an optional part of the index file, but that would involve the index format updates, so unless we need it for performance reasons, the current plan is to use a separate file, $GIT_DIR/index.aux to store this information and link it with the index file with the checksum that is already used for index file integrity check. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'cache-tree.h')
-rw-r--r--cache-tree.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/cache-tree.h b/cache-tree.h
new file mode 100644
index 0000000000..7b149afdc5
--- /dev/null
+++ b/cache-tree.h
@@ -0,0 +1,29 @@
+#ifndef CACHE_TREE_H
+#define CACHE_TREE_H
+
+struct cache_tree;
+struct cache_tree_sub {
+ struct cache_tree *cache_tree;
+ int namelen;
+ int used;
+ char name[FLEX_ARRAY];
+};
+
+struct cache_tree {
+ int entry_count; /* negative means "invalid" */
+ unsigned char sha1[20];
+ int subtree_nr;
+ int subtree_alloc;
+ struct cache_tree_sub **down;
+};
+
+struct cache_tree *cache_tree(void);
+void cache_tree_free(struct cache_tree *);
+void cache_tree_invalidate_path(struct cache_tree *, const char *);
+
+int write_cache_tree(const unsigned char *, struct cache_tree *);
+struct cache_tree *read_cache_tree(unsigned char *);
+int cache_tree_update(struct cache_tree *, struct cache_entry **, int, int);
+
+
+#endif