From bb233d690a9782e1570dc93ead2bf04aaca7cfe4 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Thu, 21 Apr 2005 10:55:18 -0700 Subject: 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. --- cache.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'cache.h') diff --git a/cache.h b/cache.h index 378299a03..02b6a7311 100644 --- a/cache.h +++ b/cache.h @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -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 */ -- cgit v1.2.1