--- a/setup.c 2010-02-07 22:50:40.000000000 -0200 +++ b/setup.c 2010-02-07 22:51:56.000000000 -0200 @@ -413,7 +413,12 @@ inside_git_dir = 0; if (!work_tree_env) inside_work_tree = 1; - git_work_tree_cfg = xstrndup(cwd, offset); + if ( cwd[0] == '/' && offset == 0 ) { + git_work_tree_cfg = xstrndup(cwd, 1); + } + else { + git_work_tree_cfg = xstrndup(cwd, offset); + } if (check_repository_format_gently(nongit_ok)) return NULL; if (offset == len)