1- #define USE_THE_REPOSITORY_VARIABLE
21#define DISABLE_SIGN_COMPARE_WARNINGS
32
43#include "git-compat-util.h"
@@ -166,7 +165,7 @@ static int match_partial_url(const char *url, void *cb)
166165 return matches ;
167166}
168167
169- static void credential_apply_config (struct credential * c )
168+ static void credential_apply_config (struct repository * r , struct credential * c )
170169{
171170 char * normalized_url ;
172171 struct urlmatch_config config = URLMATCH_CONFIG_INIT ;
@@ -191,7 +190,7 @@ static void credential_apply_config(struct credential *c)
191190 credential_format (c , & url );
192191 normalized_url = url_normalize (url .buf , & config .url );
193192
194- git_config ( urlmatch_config_entry , & config );
193+ repo_config ( r , urlmatch_config_entry , & config );
195194 string_list_clear (& config .vars , 1 );
196195 free (normalized_url );
197196 urlmatch_config_release (& config );
@@ -254,34 +253,34 @@ static char *credential_ask_one(const char *what, struct credential *c,
254253 return xstrdup (r );
255254}
256255
257- static int credential_getpass (struct credential * c )
256+ static int credential_getpass (struct repository * r , struct credential * c )
258257{
259258 int interactive ;
260259 char * value ;
261- if (!git_config_get_maybe_bool ( "credential.interactive" , & interactive ) &&
260+ if (!repo_config_get_maybe_bool ( r , "credential.interactive" , & interactive ) &&
262261 !interactive ) {
263- trace2_data_intmax ("credential" , the_repository ,
262+ trace2_data_intmax ("credential" , r ,
264263 "interactive/skipped" , 1 );
265264 return -1 ;
266265 }
267- if (!git_config_get_string ( "credential.interactive" , & value )) {
266+ if (!repo_config_get_string ( r , "credential.interactive" , & value )) {
268267 int same = !strcmp (value , "never" );
269268 free (value );
270269 if (same ) {
271- trace2_data_intmax ("credential" , the_repository ,
270+ trace2_data_intmax ("credential" , r ,
272271 "interactive/skipped" , 1 );
273272 return -1 ;
274273 }
275274 }
276275
277- trace2_region_enter ("credential" , "interactive" , the_repository );
276+ trace2_region_enter ("credential" , "interactive" , r );
278277 if (!c -> username )
279278 c -> username = credential_ask_one ("Username" , c ,
280279 PROMPT_ASKPASS |PROMPT_ECHO );
281280 if (!c -> password )
282281 c -> password = credential_ask_one ("Password" , c ,
283282 PROMPT_ASKPASS );
284- trace2_region_leave ("credential" , "interactive" , the_repository );
283+ trace2_region_leave ("credential" , "interactive" , r );
285284
286285 return 0 ;
287286}
@@ -489,7 +488,8 @@ static int credential_do(struct credential *c, const char *helper,
489488 return r ;
490489}
491490
492- void credential_fill (struct credential * c , int all_capabilities )
491+ void credential_fill (struct repository * r ,
492+ struct credential * c , int all_capabilities )
493493{
494494 int i ;
495495
@@ -499,7 +499,7 @@ void credential_fill(struct credential *c, int all_capabilities)
499499 credential_next_state (c );
500500 c -> multistage = 0 ;
501501
502- credential_apply_config (c );
502+ credential_apply_config (r , c );
503503 if (all_capabilities )
504504 credential_set_all_capabilities (c , CREDENTIAL_OP_INITIAL );
505505
@@ -526,12 +526,12 @@ void credential_fill(struct credential *c, int all_capabilities)
526526 c -> helpers .items [i ].string );
527527 }
528528
529- if (credential_getpass (c ) ||
529+ if (credential_getpass (r , c ) ||
530530 (!c -> username && !c -> password && !c -> credential ))
531531 die ("unable to get password from user" );
532532}
533533
534- void credential_approve (struct credential * c )
534+ void credential_approve (struct repository * r , struct credential * c )
535535{
536536 int i ;
537537
@@ -542,20 +542,20 @@ void credential_approve(struct credential *c)
542542
543543 credential_next_state (c );
544544
545- credential_apply_config (c );
545+ credential_apply_config (r , c );
546546
547547 for (i = 0 ; i < c -> helpers .nr ; i ++ )
548548 credential_do (c , c -> helpers .items [i ].string , "store" );
549549 c -> approved = 1 ;
550550}
551551
552- void credential_reject (struct credential * c )
552+ void credential_reject (struct repository * r , struct credential * c )
553553{
554554 int i ;
555555
556556 credential_next_state (c );
557557
558- credential_apply_config (c );
558+ credential_apply_config (r , c );
559559
560560 for (i = 0 ; i < c -> helpers .nr ; i ++ )
561561 credential_do (c , c -> helpers .items [i ].string , "erase" );
0 commit comments