File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -112,7 +112,7 @@ fn git_credential_fill(url: &str) -> Option<BasicAuthCredential> {
112112
113113 let mut res = BasicAuthCredential :: default ( ) ;
114114 for line in output. lines ( ) {
115- if let Some ( tuple) = line . split_once ( "=" ) {
115+ if let Some ( tuple) = split_once ( line , "=" ) {
116116 if tuple. 0 == "username" {
117117 res. username = Some ( tuple. 1 . to_string ( ) ) ;
118118 } else if tuple. 0 == "password" {
@@ -128,6 +128,18 @@ fn git_credential_fill(url: &str) -> Option<BasicAuthCredential> {
128128 None
129129}
130130
131+ fn split_once < ' a > (
132+ v : & ' a str ,
133+ splitter : & str ,
134+ ) -> Option < ( & ' a str , & ' a str ) > {
135+ let mut split = v. split ( splitter) ;
136+
137+ let key = split. next ( ) ;
138+ let val = split. next ( ) ;
139+
140+ key. zip ( val)
141+ }
142+
131143/// extract credentials from url
132144pub fn extract_cred_from_url ( url : & str ) -> BasicAuthCredential {
133145 if let Ok ( url) = url:: Url :: parse ( url) {
You can’t perform that action at this time.
0 commit comments