Subject: [PATCH v2 12/21] environment.c: support super .git file specified by $GIT_DIR

From: Nguyễn Thái Ngọc Duy <[email-masked]>
Date: Sat, 14 Dec 2013 17:54:58 +0700

Signed-off-by: Nguyễn Thái Ngọc Duy <[email-masked]>
---
 environment.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/environment.c b/environment.c
index d5ae7a3..cbfa879 100644
--- a/environment.c
+++ b/environment.c
@@ -125,13 +125,17 @@ static char *expand_namespace(const char *raw_namespace)
 static void setup_git_env(void)
 {
 	const char *gitfile;
+	char *super;
 
 	git_dir = getenv(GIT_DIR_ENVIRONMENT);
 	if (!git_dir)
 		git_dir = DEFAULT_GIT_DIR_ENVIRONMENT;
-	gitfile = read_gitfile(git_dir);
+	gitfile = read_gitfile_super(git_dir, &super);
 	git_dir = xstrdup(gitfile ? gitfile : git_dir);
-	git_super_dir = getenv(GIT_SUPER_DIR_ENVIRONMENT);
+	if (super)
+		git_super_dir = xstrdup(super);
+	else
+		git_super_dir = getenv(GIT_SUPER_DIR_ENVIRONMENT);
 	git_object_dir = getenv(DB_ENVIRONMENT);
 	if (!git_object_dir) {
 		git_object_dir = xmalloc(strlen(git_dir) + 9);
-- 
1.8.5.1.77.g42c48fa