Skip to content

Commit d188937

Browse files
authored
Merge pull request #9476 from Byron/fixes
Improve the git-lfs PSA message to contain the paths that are affected.
2 parents 616e273 + 6e10c7a commit d188937

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

crates/gitbutler-tauri/src/projects.rs

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use anyhow::bail;
22
use gitbutler_project::Project;
3+
use gix::bstr::ByteSlice;
34
use std::collections::BTreeSet;
45
use std::path::{Path, PathBuf};
56

@@ -217,14 +218,16 @@ fn warn_about_filters_and_git_lfs(repo: gix::Repository) -> anyhow::Result<Optio
217218
)?;
218219
let mut attrs = cache.selected_attribute_matches(Some("filter"));
219220
let mut all_filters = BTreeSet::<String>::new();
221+
let mut files_with_filter = Vec::new();
220222
for entry in index.entries() {
221-
let entry = cache.at_entry(entry.path(&index), None)?;
222-
if entry.matching_attributes(&mut attrs) {
223-
all_filters.extend(
224-
attrs
225-
.iter()
226-
.filter_map(|attr| attr.assignment.state.as_bstr().map(|s| s.to_string())),
227-
);
223+
let cache_entry = cache.at_entry(entry.path(&index), None)?;
224+
if cache_entry.matching_attributes(&mut attrs) {
225+
all_filters.extend(attrs.iter().filter_map(|attr| {
226+
attr.assignment.state.as_bstr().map(|s| {
227+
files_with_filter.push(entry.path(&index).to_str_lossy());
228+
s.to_string()
229+
})
230+
}));
228231
}
229232
}
230233

@@ -235,17 +238,18 @@ fn warn_about_filters_and_git_lfs(repo: gix::Repository) -> anyhow::Result<Optio
235238
let has_lfs = all_filters.contains("lfs");
236239
let mut msg = format!(
237240
"Worktree filter(s) detected: {comma_separated}\n\
238-
These will silently not be applied during workspace operations.\n\
239-
Assure these aren't touched by GitButler or avoid using it in this repository.\n\
240-
See https://github.com/gitbutlerapp/gitbutler/issues/2595#issuecomment-3036097607 for details.",
241+
Filters will silently not be applied during workspace operations to the files listed below.\n\
242+
Assure these aren't touched by GitButler or avoid using it in this repository.",
241243
comma_separated = Vec::from_iter(all_filters).join(", ")
242244
);
243245
if has_lfs {
244246
msg.push_str(
245247
r#"
246248
247-
Use `git lfs pull --include="*" to restore git-lfs files.`"#,
249+
`git lfs pull --include="*" to restore git-lfs files.` can be used to restore git-lfs files after GitButler touched them."#,
248250
);
249251
}
252+
msg.push_str("\n\n");
253+
msg.push_str(&files_with_filter.join("\n"));
250254
Ok(Some(msg))
251255
}

0 commit comments

Comments
 (0)