use file_exists() to check if a file exists in the worktree

Call file_exists() instead of open-coding it.  That's shorter, simpler
and the intent becomes clearer.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
René Scharfe
2015-05-19 23:44:23 +02:00
committed by Junio C Hamano
parent aaa7e0d7f8
commit dbe44faadb
5 changed files with 9 additions and 22 deletions

View File

@ -891,7 +891,6 @@ int submodule_uses_gitfile(const char *path)
int ok_to_remove_submodule(const char *path)
{
struct stat st;
ssize_t len;
struct child_process cp = CHILD_PROCESS_INIT;
const char *argv[] = {
@ -904,7 +903,7 @@ int ok_to_remove_submodule(const char *path)
struct strbuf buf = STRBUF_INIT;
int ok_to_remove = 1;
if ((lstat(path, &st) < 0) || is_empty_dir(path))
if (!file_exists(path) || is_empty_dir(path))
return 1;
if (!submodule_uses_gitfile(path))