{"thread":{"id":"133","subject":"[PATCH 4/8] init-db.c: add INDEX_FILE_DIRECTORY support","startedAt":"2005-04-19T09:09:39Z","lastAt":"2005-04-19T09:09:39Z","messageCount":1,"participants":["Zach Welch"],"isPatch":true,"patchVersion":1,"patchTotal":8},"messages":[{"id":"801","messageId":"mailbox-23311-1113901779-728644@spoon","threadId":"133","inReplyTo":null,"subject":"[PATCH 4/8] init-db.c: add INDEX_FILE_DIRECTORY support","fromName":"Zach Welch","fromEmail":"zw@superlucidity.net","sentAt":"2005-04-19T09:09:39Z","receivedAt":"2005-04-19T09:09:39Z","isPatch":true,"sender":{"key":"zw@superlucidity.net","avatar":null},"body":"This patch give init-db the ability for the index directory to be \noverridden by the INDEX_FILE_DIRECTORY environment variable.\n\nThis patch applies on top of:\n        [PATCH 0/8] init-db.c cleanup, add INDEX_FILE_DIRECTORY support\n        [PATCH 1/8] init-db.c: [RESEND] remove redundant getenv call\n        [PATCH 2/8] init-db.c: [RESEND] make init-db work with common objects\n        [PATCH 3/8] init-db.c: refactor directory creation\n cache.h   |    3 +++\n init-db.c |    5 +----\n 2 files changed, 4 insertions(+), 4 deletions(-)\nSigned-Off-By: Zach Welch <zw@superlucidity.net>\n\n\n--- a/cache.h\t2005-04-18 21:13:36.000000000 -0700\n+++ b/cache.h\t2005-04-18 21:13:44.000000000 -0700\n@@ -81,6 +81,9 @@\n struct cache_entry **active_cache;\n unsigned int active_nr, active_alloc;\n \n+#define INDEX_ENVIRONMENT \"INDEX_FILE_DIRECTORY\"\n+#define DEFAULT_INDEX_ENVIRONMENT \".git\"\n+\n #define DB_ENVIRONMENT \"SHA1_FILE_DIRECTORY\"\n #define DEFAULT_DB_ENVIRONMENT \".git/objects\"\n \n--- a/init-db.c\t2005-04-18 21:21:02.000000000 -0700\n+++ b/init-db.c\t2005-04-18 21:15:14.000000000 -0700\n@@ -42,10 +42,7 @@\n \tchar *sha1_dir, *path;\n \tint len, i;\n \n-\tif (mkdir(\".git\", 0755) < 0) {\n-\t\tperror(\"unable to create .git directory\");\n-\t\texit(1);\n-\t}\n+\t(void) init_dir(INDEX_ENVIRONMENT, DEFAULT_INDEX_ENVIRONMENT, \"index\", NULL);\n \tsha1_dir = init_dir(DB_ENVIRONMENT, DEFAULT_DB_ENVIRONMENT, \"storage\", &len);\n \t\n \tpath = malloc(len + 40);\n"}]}