setup: clean up setup_bare_git_dir()
work_tree_env argument is removed because this function does not need it. GIT_WORK_TREE is only effective inside setup_explicit_git_dir. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
e6aea2dba2
commit
1cd8031b2d
17
setup.c
17
setup.c
@ -405,13 +405,15 @@ static const char *setup_discovered_git_dir(const char *work_tree_env,
|
|||||||
return cwd + offset;
|
return cwd + offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *setup_bare_git_dir(const char *work_tree_env,
|
/* #16.1, #17.1, #20.1, #21.1, #22.1 (see t1510) */
|
||||||
int offset, int len, char *cwd, int *nongit_ok)
|
static const char *setup_bare_git_dir(char *cwd, int offset, int len, int *nongit_ok)
|
||||||
{
|
{
|
||||||
int root_len;
|
int root_len;
|
||||||
|
|
||||||
|
if (check_repository_format_gently(".", nongit_ok))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
inside_git_dir = 1;
|
inside_git_dir = 1;
|
||||||
if (!work_tree_env)
|
|
||||||
inside_work_tree = 0;
|
inside_work_tree = 0;
|
||||||
if (offset != len) {
|
if (offset != len) {
|
||||||
if (chdir(cwd))
|
if (chdir(cwd))
|
||||||
@ -419,12 +421,9 @@ static const char *setup_bare_git_dir(const char *work_tree_env,
|
|||||||
root_len = offset_1st_component(cwd);
|
root_len = offset_1st_component(cwd);
|
||||||
cwd[offset > root_len ? offset : root_len] = '\0';
|
cwd[offset > root_len ? offset : root_len] = '\0';
|
||||||
set_git_dir(cwd);
|
set_git_dir(cwd);
|
||||||
check_repository_format_gently(cwd, nongit_ok);
|
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
set_git_dir(".");
|
set_git_dir(".");
|
||||||
check_repository_format_gently(".", nongit_ok);
|
|
||||||
}
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -509,8 +508,8 @@ static const char *setup_git_directory_gently_1(int *nongit_ok)
|
|||||||
offset, len,
|
offset, len,
|
||||||
cwd, nongit_ok);
|
cwd, nongit_ok);
|
||||||
if (is_git_directory("."))
|
if (is_git_directory("."))
|
||||||
return setup_bare_git_dir(work_tree_env, offset,
|
return setup_bare_git_dir(cwd, offset, len, nongit_ok);
|
||||||
len, cwd, nongit_ok);
|
|
||||||
while (--offset > ceil_offset && cwd[offset] != '/');
|
while (--offset > ceil_offset && cwd[offset] != '/');
|
||||||
if (offset <= ceil_offset)
|
if (offset <= ceil_offset)
|
||||||
return setup_nongit(cwd, nongit_ok);
|
return setup_nongit(cwd, nongit_ok);
|
||||||
|
Reference in New Issue
Block a user