File tree Expand file tree Collapse file tree 2 files changed +14
-11
lines changed
Expand file tree Collapse file tree 2 files changed +14
-11
lines changed Original file line number Diff line number Diff line change @@ -2,16 +2,21 @@ use std::env::current_dir;
22use std:: process:: Command ;
33
44pub fn add_remote ( name : & str , url : & str ) -> bool {
5- match ( current_dir ( ) , can_create_remote ( name) ) {
6- ( Ok ( dir) , true ) if dir. ancestors ( ) . any ( |p| p. join ( ".git" ) . exists ( ) ) => Command :: new ( "git" )
7- . arg ( "remote" )
8- . arg ( "add" )
9- . arg ( name)
10- . arg ( url)
11- . output ( )
12- . is_ok ( ) ,
13- _ => false ,
5+ if can_create_remote ( name) {
6+ if let Ok ( dir) = current_dir ( ) {
7+ if dir. ancestors ( ) . any ( |p| p. join ( ".git" ) . exists ( ) ) {
8+ return Command :: new ( "git" )
9+ . arg ( "remote" )
10+ . arg ( "add" )
11+ . arg ( name)
12+ . arg ( url)
13+ . output ( )
14+ . is_ok ( ) ;
15+ }
16+ }
1417 }
18+
19+ false
1520}
1621
1722fn can_create_remote ( name : & str ) -> bool {
Original file line number Diff line number Diff line change 1- #![ feature( bind_by_move_pattern_guards) ]
2-
31use cli:: Gitpo ;
42use reqwest:: StatusCode ;
53use std:: process:: exit;
You can’t perform that action at this time.
0 commit comments