File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff 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}
Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments