@@ -6,9 +6,11 @@ enum Error {
66 Configuration ( #[ from] gix:: config:: credential_helpers:: Error ) ,
77 #[ error( transparent) ]
88 Protocol ( #[ from] gix:: credentials:: protocol:: Error ) ,
9+ #[ error( transparent) ]
10+ ConfigLoad ( #[ from] gix:: config:: file:: init:: from_paths:: Error ) ,
911}
1012
11- pub fn function ( repo : gix:: Repository , action : gix:: credentials:: program:: main:: Action ) -> anyhow:: Result < ( ) > {
13+ pub fn function ( repo : Option < gix:: Repository > , action : gix:: credentials:: program:: main:: Action ) -> anyhow:: Result < ( ) > {
1214 use gix:: credentials:: program:: main:: Action :: * ;
1315 gix:: credentials:: program:: main (
1416 Some ( action. as_str ( ) . into ( ) ) ,
@@ -20,9 +22,24 @@ pub fn function(repo: gix::Repository, action: gix::credentials::program::main::
2022 . clone ( )
2123 . or_else ( || context. to_url ( ) )
2224 . ok_or ( Error :: Protocol ( gix:: credentials:: protocol:: Error :: UrlMissing ) ) ?;
23- let ( mut cascade, _action, prompt_options) = repo
24- . config_snapshot ( )
25- . credential_helpers ( gix:: url:: parse ( url. as_ref ( ) ) ?) ?;
25+
26+ let ( mut cascade, _action, prompt_options) = match repo {
27+ Some ( ref repo) => repo
28+ . config_snapshot ( )
29+ . credential_helpers ( gix:: url:: parse ( url. as_ref ( ) ) ?) ?,
30+ None => {
31+ let config = gix:: config:: File :: from_globals ( ) ?;
32+ let environment = gix:: open:: permissions:: Environment :: all ( ) ;
33+ gix:: config:: credential_helpers (
34+ gix:: url:: parse ( url. as_ref ( ) ) ?,
35+ & config,
36+ false ,
37+ |_| true ,
38+ environment,
39+ false ,
40+ ) ?
41+ }
42+ } ;
2643 cascade
2744 . invoke (
2845 match action {
0 commit comments