From c7054209d65db430bdbcb2243288e63cea3e417c Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 30 May 2017 09:23:33 +0900 Subject: treewide: use is_missing_file_error() where ENOENT and ENOTDIR are checked Using the is_missing_file_error() helper introduced in the previous step, update all hits from $ git grep -e ENOENT --and -e ENOTDIR There are codepaths that only check ENOENT, and it is possible that some of them should be checking both. Updating them is kept out of this step deliberately, as we do not want to change behaviour in this step. Signed-off-by: Junio C Hamano --- sha1_name.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sha1_name.c') diff --git a/sha1_name.c b/sha1_name.c index 26ceec1d7..af7500037 100644 --- a/sha1_name.c +++ b/sha1_name.c @@ -1406,7 +1406,7 @@ static void diagnose_invalid_sha1_path(const char *prefix, if (file_exists(filename)) die("Path '%s' exists on disk, but not in '%.*s'.", filename, object_name_len, object_name); - if (errno == ENOENT || errno == ENOTDIR) { + if (is_missing_file_error(errno)) { char *fullname = xstrfmt("%s%s", prefix, filename); if (!get_tree_entry(tree_sha1, fullname, @@ -1471,7 +1471,7 @@ static void diagnose_invalid_index_path(int stage, if (file_exists(filename)) die("Path '%s' exists on disk, but not in the index.", filename); - if (errno == ENOENT || errno == ENOTDIR) + if (is_missing_file_error(errno)) die("Path '%s' does not exist (neither on disk nor in the index).", filename); -- cgit v1.2.1