void setup_work_tree(void)
{
- struct strbuf sb = STRBUF_INIT;
const char *work_tree, *git_dir;
static int initialized = 0;
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)
{
const char *env_ceiling_dirs = getenv(CEILING_DIRECTORIES_ENVIRONMENT);
struct string_list ceiling_dirs = STRING_LIST_INIT_DUP;
- static char cwd[PATH_MAX+1];
+ static char cwd[PATH_MAX + 1];
const char *gitdirenv, *ret;
char *gitfile;
int len, offset, offset_parent, ceil_offset = -1;
if (nongit_ok)
*nongit_ok = 0;
- if (!getcwd(cwd, sizeof(cwd)-1))
+ if (!getcwd(cwd, sizeof(cwd) - 1))
die_errno("Unable to read current working directory");
offset = len = strlen(cwd);