[Commented On] D10111: rhg: Sort config files when adding a directory

baymax (Baymax, Your Personal Patch-care Companion) phabricator at mercurial-scm.org
Thu Mar 4 13:01:34 UTC 2021


baymax added a comment.
baymax updated this revision to Diff 26078.


  ✅ refresh by Heptapod after a successful CI run (🐙 💚)

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D10111?vs=26053&id=26078

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D10111/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D10111

AFFECTED FILES
  rust/hg-core/src/config/config.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/config/config.rs b/rust/hg-core/src/config/config.rs
--- a/rust/hg-core/src/config/config.rs
+++ b/rust/hg-core/src/config/config.rs
@@ -107,8 +107,13 @@
             .when_reading_file(path)
             .io_not_found_as_none()?
         {
-            for entry in entries {
-                let file_path = entry.when_reading_file(path)?.path();
+            let mut file_paths = entries
+                .map(|result| {
+                    result.when_reading_file(path).map(|entry| entry.path())
+                })
+                .collect::<Result<Vec<_>, _>>()?;
+            file_paths.sort();
+            for file_path in &file_paths {
                 if file_path.extension() == Some(std::ffi::OsStr::new("rc")) {
                     self.add_trusted_file(&file_path)?
                 }



To: SimonSapin, #hg-reviewers
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20210304/4ff5d2b4/attachment-0002.html>


More information about the Mercurial-patches mailing list