summaryrefslogtreecommitdiff
path: root/cache.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-21 17:55:18 (GMT)
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-21 17:55:18 (GMT)
commitbb233d690a9782e1570dc93ead2bf04aaca7cfe4 (patch)
treefb5599a254b880afd905dcef56c639292f94b6ee /cache.h
parent65bb49144d26a10837582a99e66041035319ff91 (diff)
downloadgit-bb233d690a9782e1570dc93ead2bf04aaca7cfe4.zip
git-bb233d690a9782e1570dc93ead2bf04aaca7cfe4.tar.gz
git-bb233d690a9782e1570dc93ead2bf04aaca7cfe4.tar.bz2
Add support for a "GIT_INDEX_FILE" environment variable.
We use that to specify alternative index files, which can be useful if you want to (for example) generate a temporary index file to do some specific operation that you don't want to mess with your main one with. It defaults to the regular ".git/index" if it hasn't been specified.
Diffstat (limited to 'cache.h')
-rw-r--r--cache.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/cache.h b/cache.h
index 378299a..02b6a73 100644
--- a/cache.h
+++ b/cache.h
@@ -11,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>
@@ -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 */