diff rust/hg-core/src/dirstate_tree/status.rs @ 47346:5e12b6bfdd3e

dirstate-tree: Fix status algorithm with unreadable directory When reading a directory fails such as because of insufficient permissions, it should be treated as empty by status instead of skipped entirely. Differential Revision: https://phab.mercurial-scm.org/D10823
author Simon Sapin <simon.sapin@octobus.net>
date Fri, 28 May 2021 12:16:14 +0200
parents f27f2afb15da
children 73ddcedeaadf
line wrap: on
line diff
--- a/rust/hg-core/src/dirstate_tree/status.rs	Tue May 25 16:46:32 2021 -0700
+++ b/rust/hg-core/src/dirstate_tree/status.rs	Fri May 28 12:16:14 2021 +0200
@@ -141,7 +141,10 @@
         ) {
             entries
         } else {
-            return Ok(());
+            // 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.
+            Vec::new()
         };
 
         // `merge_join_by` requires both its input iterators to be sorted: