Eliminate an unnecessary chdir("..")
In the case where setup_git_directory_gently fails, avoid the last chdir("..") by moving it after the ceil_offset check. Signed-off-by: David Reiss <dreiss@facebook.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
0454dd93bf
commit
450f437fb0
2
setup.c
2
setup.c
@ -446,7 +446,6 @@ const char *setup_git_directory_gently(int *nongit_ok)
|
|||||||
check_repository_format_gently(nongit_ok);
|
check_repository_format_gently(nongit_ok);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
chdir("..");
|
|
||||||
while (--offset > ceil_offset && cwd[offset] != '/');
|
while (--offset > ceil_offset && cwd[offset] != '/');
|
||||||
if (offset <= ceil_offset) {
|
if (offset <= ceil_offset) {
|
||||||
if (nongit_ok) {
|
if (nongit_ok) {
|
||||||
@ -457,6 +456,7 @@ const char *setup_git_directory_gently(int *nongit_ok)
|
|||||||
}
|
}
|
||||||
die("Not a git repository");
|
die("Not a git repository");
|
||||||
}
|
}
|
||||||
|
chdir("..");
|
||||||
}
|
}
|
||||||
|
|
||||||
inside_git_dir = 0;
|
inside_git_dir = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user