Include <limits.h> in commit.c for ULONG_MAX. Remove old "revision.h".
[git.git] / cache.h
diff --git a/cache.h b/cache.h
index dd91a71..02b6a73 100644 (file)
--- a/cache.h
+++ b/cache.h
@@ -1,6 +1,7 @@
 #ifndef CACHE_H
 #define CACHE_H
 
+#include <unistd.h>
 #include <stdio.h>
 #include <sys/stat.h>
 #include <fcntl.h>
@@ -10,6 +11,7 @@
 #include <string.h>
 #include <errno.h>
 #include <sys/mman.h>
+#include <sys/param.h>
 #include <netinet/in.h>
 
 #include <openssl/sha.h>
@@ -28,7 +30,6 @@ struct cache_header {
        unsigned int hdr_signature;
        unsigned int hdr_version;
        unsigned int hdr_entries;
-       unsigned char sha1[20];
 };
 
 /*
@@ -84,6 +85,13 @@ unsigned int active_nr, active_alloc;
 #define DB_ENVIRONMENT "SHA1_FILE_DIRECTORY"
 #define DEFAULT_DB_ENVIRONMENT ".git/objects"
 
+#define get_object_directory() (getenv(DB_ENVIRONMENT) ? : DEFAULT_DB_ENVIRONMENT)
+
+#define INDEX_ENVIRONMENT "GIT_INDEX_FILE"
+#define DEFAULT_INDEX_ENVIRONMENT ".git/index"
+
+#define get_index_file() (getenv(INDEX_ENVIRONMENT) ? : DEFAULT_INDEX_ENVIRONMENT)
+
 #define alloc_nr(x) (((x)+16)*3/2)
 
 /* Initialize and use the cache information */
@@ -125,4 +133,8 @@ extern int error(const char *err, ...);
 
 extern int cache_name_compare(const char *name1, int len1, const char *name2, int len2);
 
+extern void *read_tree_with_tree_or_commit_sha1(const unsigned char *sha1,
+                                               unsigned long *size,
+                                               unsigned char *tree_sha1_ret);
+
 #endif /* CACHE_H */