Skip to content
This repository was archived by the owner on Jan 2, 2025. It is now read-only.

Commit 770fa7a

Browse files
authored
Revert "Index hidden files for filesystem repos (#471)"
This reverts commit 847fd47.
1 parent 847fd47 commit 770fa7a

File tree

2 files changed

+7
-21
lines changed

2 files changed

+7
-21
lines changed

server/bleep/src/repo/iterator.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,9 @@ impl FileType {
4747
}
4848
}
4949

50-
fn should_index_entry(de: &ignore::DirEntry) -> bool {
51-
should_index(&de.path())
52-
}
53-
5450
fn should_index<P: AsRef<Path>>(p: &P) -> bool {
5551
let path = p.as_ref();
5652

57-
// TODO: Make this more robust
58-
if path.components().any(|c| c.as_os_str() == ".git") {
59-
return false;
60-
}
61-
6253
#[rustfmt::skip]
6354
const EXT_BLACKLIST: &[&str] = &[
6455
// graphics
@@ -158,11 +149,6 @@ mod test {
158149
// These are not typically vendored in Rust.
159150
("dist/main.rs", true),
160151
("vendor/foo.rs", true),
161-
// Ignore .git directory.
162-
(".git/HEAD", false),
163-
(".git/config", false),
164-
(".gitignore", true),
165-
(".github/workflows/ci.yml", true),
166152
];
167153

168154
for (path, index) in tests {

server/bleep/src/repo/iterator/fs.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,7 @@ pub struct FileWalker {
1111
impl FileWalker {
1212
pub fn index_directory(dir: impl AsRef<Path>) -> impl FileSource {
1313
// note: this WILL observe .gitignore files for the respective repos.
14-
let walker = ignore::WalkBuilder::new(&dir)
15-
.standard_filters(true)
16-
.hidden(false)
17-
.filter_entry(should_index_entry)
18-
.build();
19-
20-
let file_list = walker
14+
let file_list = ignore::Walk::new(&dir)
2115
.filter_map(|de| match de {
2216
Ok(de) => Some(de),
2317
Err(err) => {
@@ -28,6 +22,12 @@ impl FileWalker {
2822
// Preliminarily ignore files that are very large, without reading the contents.
2923
.filter(|de| matches!(de.metadata(), Ok(meta) if meta.len() < MAX_FILE_LEN))
3024
.filter_map(|de| crate::canonicalize(de.into_path()).ok())
25+
.filter(|p| {
26+
p.strip_prefix(&dir)
27+
.as_ref()
28+
.map(should_index)
29+
.unwrap_or_default()
30+
})
3131
.collect();
3232

3333
Self { file_list }

0 commit comments

Comments
 (0)