Merge branch 'jk/refs-c-squelch-gcc'
[gitweb.git] / setup.c
diff --git a/setup.c b/setup.c
index f08dd649761f4d53abef66da052340a3c78d0fe5..dbf41387204766981ebda444bc56a0884f9341f5 100644 (file)
--- a/setup.c
+++ b/setup.c
@@ -227,7 +227,6 @@ int is_inside_work_tree(void)
 
 void setup_work_tree(void)
 {
-       struct strbuf sb = STRBUF_INIT;
        const char *work_tree, *git_dir;
        static int initialized = 0;
 
@@ -247,10 +246,8 @@ void setup_work_tree(void)
        if (getenv(GIT_WORK_TREE_ENVIRONMENT))
                setenv(GIT_WORK_TREE_ENVIRONMENT, ".", 1);
 
-       set_git_dir(relative_path(git_dir, work_tree, &sb));
+       set_git_dir(remove_leading_path(git_dir, work_tree));
        initialized = 1;
-
-       strbuf_release(&sb);
 }
 
 static int check_repository_format_gently(const char *gitdir, int *nongit_ok)