diff --git a/src/fileops.c b/src/fileops.c index 92b95c5dd..b11119b91 100644 --- a/src/fileops.c +++ b/src/fileops.c @@ -170,6 +170,12 @@ int gitfo_isfile(const char *path) } int gitfo_exists(const char *path) +{ + assert(path); + return access(path, F_OK); +} + +int gitfo_shallow_exists(const char *path) { assert(path); diff --git a/src/index.c b/src/index.c index 3d2e72e56..798d9e918 100644 --- a/src/index.c +++ b/src/index.c @@ -411,7 +411,7 @@ static int index_init_entry(git_index_entry *entry, git_index *index, const char git__joinpath(full_path, index->repository->path_workdir, rel_path); - if (gitfo_exists(full_path) < 0) + if (gitfo_shallow_exists(full_path) < 0) return git__throw(GIT_ENOTFOUND, "Failed to initialize entry. %s does not exist", full_path); if (gitfo_lstat(full_path, &st) < 0)