diff options
author | René Scharfe <l.s.r@web.de> | 2015-05-19 23:44:23 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-05-20 13:49:10 -0700 |
commit | dbe44faadb87f88e092f3dac387f96070268137a (patch) | |
tree | c110408d6bae73334427aaec8010bdb2e754e69d /submodule.c | |
parent | aaa7e0d7f8f003c0c8ab34f959083f6d191d44ca (diff) | |
download | git-dbe44faadb87f88e092f3dac387f96070268137a.tar.gz |
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>
Diffstat (limited to 'submodule.c')
-rw-r--r-- | submodule.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/submodule.c b/submodule.c index c0e6c81fc4..5a563ad100 100644 --- a/submodule.c +++ b/submodule.c @@ -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)) |