Skip to content

Commit 774e804

Browse files
committed
small update to give the processed file a better name
1 parent 3e52771 commit 774e804

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/processing.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,5 +210,5 @@ fn ignore_due_to_pattern(
210210
};
211211
ignore_patterns
212212
.iter()
213-
.any(|pattern| relative_path_str.contains(&pattern.replace("\\", "/")))
213+
.any(|pattern| relative_path_str.starts_with(&pattern.replace("\\", "/")))
214214
}

src/repository.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,14 @@ impl Repository {
2828

2929
/// Creates a new Repository instance from a local file system path.
3030
pub fn from_local_path(local_path: &Path) -> Self {
31-
31+
let name = local_path
32+
.file_name() // Get the final component of the path (the folder name)
33+
.and_then(|s| s.to_str()) // Convert it to a string slice
34+
.unwrap_or("local-repo") // Fallback if the name is not valid UTF-8
35+
.to_string();
3236
Self {
3337
url: "local".to_string(), // URL is not applicable
34-
name: "local-repo".to_string(), // A generic name for local repos
38+
name,
3539
path: local_path.to_path_buf(), // The path is the provided local path
3640
content: None,
3741
}

0 commit comments

Comments
 (0)