The original intent of the private files API was for it to be a merge, not an overwrite.

Mikayla Maki created

Change summary

crates/settings/src/settings_content/project.rs | 2 +-
crates/worktree/src/worktree_settings.rs        | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)

Detailed changes

crates/settings/src/settings_content/project.rs 🔗

@@ -80,7 +80,7 @@ pub struct WorktreeSettingsContent {
     pub file_scan_inclusions: Option<Vec<String>>,
 
     /// Treat the files matching these globs as `.env` files.
-    /// Default: [ "**/.env*" ]
+    /// Default: ["**/.env*", "**/*.pem", "**/*.key", "**/*.cert", "**/*.crt", "**/secrets.yml"]
     pub private_files: Option<Vec<String>>,
 }
 

crates/worktree/src/worktree_settings.rs 🔗

@@ -66,11 +66,11 @@ impl Settings for WorktreeSettings {
             self.project_name = Some(project_name);
         }
 
-        // todo!() test this. Did it used to extend the arrays, or overwrite them?
-
-        if let Some(private_files) = worktree.private_files.clone() {
+        if let Some(mut private_files) = worktree.private_files.clone() {
+            let sources = self.private_files.sources();
+            private_files.extend_from_slice(sources);
             if let Some(matchers) = path_matchers(private_files, "private_files").log_err() {
-                self.private_files = matchers
+                self.private_files = matchers;
             }
         }