Merge branch 'jn/gitweb-customlinks'
[gitweb.git] / environment.c
index df4f03a95f0b2098e97d0410bbb0589ff887e9cb..bb96ac0a71bc5614cd3352902586ff0a70a4eece 100644 (file)
@@ -80,6 +80,11 @@ int is_bare_repository(void)
        return is_bare_repository_cfg && !get_git_work_tree();
 }
 
+int have_git_dir(void)
+{
+       return !!git_dir;
+}
+
 const char *get_git_dir(void)
 {
        if (!git_dir)
@@ -113,7 +118,7 @@ const char *get_git_work_tree(void)
                        work_tree = git_work_tree_cfg;
                        /* make_absolute_path also normalizes the path */
                        if (work_tree && !is_absolute_path(work_tree))
-                               work_tree = xstrdup(make_absolute_path(git_path(work_tree)));
+                               work_tree = xstrdup(make_absolute_path(git_path("%s", work_tree)));
                } else if (work_tree)
                        work_tree = xstrdup(make_absolute_path(work_tree));
                git_work_tree_initialized = 1;