git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 4/8] init-db.c: add INDEX_FILE_DIRECTORY support

From
ZWZach Welch <zw@superlucidity.net>
Date
Apr 19, 2005, 09:09 UTC
Message-ID
<mailbox-23311-1113901779-728644@spoon>

This patch give init-db the ability for the index directory to be overridden by the INDEX_FILE_DIRECTORY environment variable.

This patch applies on top of:
        [PATCH 0/8] init-db.c cleanup, add INDEX_FILE_DIRECTORY support
        [PATCH 1/8] init-db.c: [RESEND] remove redundant getenv call
        [PATCH 2/8] init-db.c: [RESEND] make init-db work with common objects
        [PATCH 3/8] init-db.c: refactor directory creation
 cache.h   |    3 +++
 init-db.c |    5 +----
 2 files changed, 4 insertions(+), 4 deletions(-)
Signed-Off-By: Zach Welch <zw@superlucidity.net>
--- a/cache.h	2005-04-18 21:13:36.000000000 -0700
+++ b/cache.h	2005-04-18 21:13:44.000000000 -0700
@@ -81,6 +81,9 @@
 struct cache_entry **active_cache;
 unsigned int active_nr, active_alloc;
 
+#define INDEX_ENVIRONMENT "INDEX_FILE_DIRECTORY"
+#define DEFAULT_INDEX_ENVIRONMENT ".git"
+
 #define DB_ENVIRONMENT "SHA1_FILE_DIRECTORY"
 #define DEFAULT_DB_ENVIRONMENT ".git/objects"
 
--- a/init-db.c	2005-04-18 21:21:02.000000000 -0700
+++ b/init-db.c	2005-04-18 21:15:14.000000000 -0700
@@ -42,10 +42,7 @@
 	char *sha1_dir, *path;
 	int len, i;
 
-	if (mkdir(".git", 0755) < 0) {
-		perror("unable to create .git directory");
-		exit(1);
-	}
+	(void) init_dir(INDEX_ENVIRONMENT, DEFAULT_INDEX_ENVIRONMENT, "index", NULL);
 	sha1_dir = init_dir(DB_ENVIRONMENT, DEFAULT_DB_ENVIRONMENT, "storage", &len);
 	
 	path = malloc(len + 40);
Message 1 of 1 in “init-db.c: add INDEX_FILE_DIRECTORY support”
  1. 4/8 init-db.c: add INDEX_FILE_DIRECTORY supportZach Welch, Apr 19, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.