File tree 1 file changed +9
-13
lines changed
1 file changed +9
-13
lines changed Original file line number Diff line number Diff line change @@ -382,26 +382,22 @@ impl Info {
382
382
let config = repo. config ( ) . map_err ( |_| Error :: NoGitData ) ;
383
383
let mut remote_url = String :: new ( ) ;
384
384
let mut repository_name = String :: new ( ) ;
385
- let mut remote_upstream: Option < String > = None ;
386
385
387
386
for entry in & config. unwrap ( ) . entries ( None ) . unwrap ( ) {
388
387
let entry = entry. unwrap ( ) ;
389
- match entry. name ( ) . unwrap ( ) {
390
- "remote.origin.url" => remote_url = entry. value ( ) . unwrap ( ) . to_string ( ) ,
391
- "remote.upstream.url" => remote_upstream = Some ( entry. value ( ) . unwrap ( ) . to_string ( ) ) ,
392
- _ => ( ) ,
393
- }
394
- }
395
-
396
- if let Some ( url) = remote_upstream {
397
- remote_url = url;
388
+ if let "remote.origin.url" = entry. name ( ) . unwrap ( ) {
389
+ remote_url = entry. value ( ) . unwrap ( ) . to_string ( )
390
+ } ;
398
391
}
399
392
400
- let url = remote_url;
401
- let name_parts: Vec < & str > = url. split ( '/' ) . collect ( ) ;
393
+ let name_parts: Vec < & str > = remote_url. split ( '/' ) . collect ( ) ;
402
394
403
395
if !name_parts. is_empty ( ) {
404
- repository_name = name_parts[ name_parts. len ( ) - 1 ] . to_string ( ) ;
396
+ if remote_url. ends_with ( '/' ) {
397
+ repository_name = name_parts[ name_parts. len ( ) - 2 ] . to_string ( ) ;
398
+ } else {
399
+ repository_name = name_parts[ name_parts. len ( ) - 1 ] . to_string ( ) ;
400
+ }
405
401
}
406
402
407
403
if repository_name. contains ( ".git" ) {
You can’t perform that action at this time.
0 commit comments