diff rust/rhg/src/commands/status.rs @ 51747:48fd4d23c867 stable

rhg: expand user and environment variables in ignore includes This was reported by a user, and was a TODO long overdue.
author Rapha?l Gom?s <rgomes@octobus.net>
date Thu, 01 Aug 2024 14:00:07 +0200
parents eab5b061cd48
children 955084b4f74f
line wrap: on
line diff
--- a/rust/rhg/src/commands/status.rs	Fri Jul 26 10:52:28 2024 +0200
+++ b/rust/rhg/src/commands/status.rs	Thu Aug 01 14:00:07 2024 +0200
@@ -632,9 +632,11 @@
     for (key, value) in config.iter_section(b"ui") {
         if key == b"ignore" || key.starts_with(b"ignore.") {
             let path = get_path_from_bytes(value);
-            // TODO: expand "~/" and environment variable here, like Python
-            // does with `os.path.expanduser` and `os.path.expandvars`
-
+            let path = shellexpand::path::full_with_context_no_errors(
+                path,
+                home::home_dir,
+                |s| std::env::var(s).ok(),
+            );
             let joined = repo.working_directory_path().join(path);
             ignore_files.push(joined);
         }