提交 450f437f 编写于 作者: D David Reiss 提交者: Junio C Hamano

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: NDavid Reiss <dreiss@facebook.com>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 0454dd93
......@@ -446,7 +446,6 @@ const char *setup_git_directory_gently(int *nongit_ok)
check_repository_format_gently(nongit_ok);
return NULL;
}
chdir("..");
while (--offset > ceil_offset && cwd[offset] != '/');
if (offset <= ceil_offset) {
if (nongit_ok) {
......@@ -457,6 +456,7 @@ const char *setup_git_directory_gently(int *nongit_ok)
}
die("Not a git repository");
}
chdir("..");
}
inside_git_dir = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册