rust/hg-core/src/dirstate_tree/status.rs
branchstable
changeset 50294 bae51b50a5cf
parent 49930 e98fd81bb151
child 50300 edcc35a4f1dc
--- a/rust/hg-core/src/dirstate_tree/status.rs	Fri Mar 10 18:20:50 2023 +0000
+++ b/rust/hg-core/src/dirstate_tree/status.rs	Mon Mar 13 14:15:34 2023 +0000
@@ -433,16 +433,21 @@
             return Ok(children_all_have_dirstate_node_or_are_ignored);
         }
 
+        let readdir_succeeded;
         let mut fs_entries = if let Ok(entries) = self.read_dir(
             directory_hg_path,
             &directory_entry.fs_path,
             is_at_repo_root,
         ) {
+            readdir_succeeded = true;
             entries
         } else {
             // Treat an unreadable directory (typically because of insufficient
             // permissions) like an empty directory. `self.read_dir` has
             // already called `self.io_error` so a warning will be emitted.
+            // We still need to remember that there was an error so that we
+            // know not to cache this result.
+            readdir_succeeded = false;
             Vec::new()
         };
 
@@ -495,6 +500,7 @@
             Ok(has_dirstate_node_or_is_ignored)
         })
         .try_reduce(|| true, |a, b| Ok(a && b))
+        .map(|res| res && readdir_succeeded)
     }
 
     fn traverse_fs_and_dirstate<'ancestor>(