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

SimonSapin phabricator at mercurial-scm.org
Tue Mar 16 21:45:48 UTC 2021


Closed by commit rHG60fe9ebae29b: rhg: Sort config files when adding a directory (authored by SimonSapin).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".

REPOSITORY
  rHG Mercurial

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

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
@@ -125,8 +125,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, Alphare, marmoute
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20210316/434ab05e/attachment-0002.html>


More information about the Mercurial-patches mailing list