summaryrefslogtreecommitdiff
path: root/builtin/rm.c
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2015-05-19 21:44:23 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-05-20 20:49:10 (GMT)
commitdbe44faadb87f88e092f3dac387f96070268137a (patch)
treec110408d6bae73334427aaec8010bdb2e754e69d /builtin/rm.c
parentaaa7e0d7f8f003c0c8ab34f959083f6d191d44ca (diff)
downloadgit-dbe44faadb87f88e092f3dac387f96070268137a.zip
git-dbe44faadb87f88e092f3dac387f96070268137a.tar.gz
git-dbe44faadb87f88e092f3dac387f96070268137a.tar.bz2
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 'builtin/rm.c')
-rw-r--r--builtin/rm.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/builtin/rm.c b/builtin/rm.c
index 3304bff..80b972f 100644
--- a/builtin/rm.c
+++ b/builtin/rm.c
@@ -84,7 +84,6 @@ static int check_submodules_use_gitfiles(void)
const char *name = list.entry[i].name;
int pos;
const struct cache_entry *ce;
- struct stat st;
pos = cache_name_pos(name, strlen(name));
if (pos < 0) {
@@ -95,7 +94,7 @@ static int check_submodules_use_gitfiles(void)
ce = active_cache[pos];
if (!S_ISGITLINK(ce->ce_mode) ||
- (lstat(ce->name, &st) < 0) ||
+ !file_exists(ce->name) ||
is_empty_dir(name))
continue;