@@ -1768,6 +1768,42 @@ static const char *get_frequency(enum schedule_priority schedule)
17681768 }
17691769}
17701770
1771+ static const char * extraconfig [] = {
1772+ "credential.interactive=false" ,
1773+ "core.askPass=true" , /* 'true' returns success, but no output. */
1774+ NULL
1775+ };
1776+
1777+ static const char * get_extra_config_parameters (void ) {
1778+ static const char * result = NULL ;
1779+ struct strbuf builder = STRBUF_INIT ;
1780+
1781+ if (result )
1782+ return result ;
1783+
1784+ for (const char * * s = extraconfig ; s && * s ; s ++ )
1785+ strbuf_addf (& builder , "-c %s " , * s );
1786+
1787+ result = strbuf_detach (& builder , NULL );
1788+ return result ;
1789+ }
1790+
1791+ static const char * get_extra_launchctl_strings (void ) {
1792+ static const char * result = NULL ;
1793+ struct strbuf builder = STRBUF_INIT ;
1794+
1795+ if (result )
1796+ return result ;
1797+
1798+ for (const char * * s = extraconfig ; s && * s ; s ++ ) {
1799+ strbuf_addstr (& builder , "<string>-c</string>\n" );
1800+ strbuf_addf (& builder , "<string>%s</string>\n" , * s );
1801+ }
1802+
1803+ result = strbuf_detach (& builder , NULL );
1804+ return result ;
1805+ }
1806+
17711807/*
17721808 * get_schedule_cmd` reads the GIT_TEST_MAINT_SCHEDULER environment variable
17731809 * to mock the schedulers that `git maintenance start` rely on.
@@ -1981,6 +2017,7 @@ static int launchctl_schedule_plist(const char *exec_path, enum schedule_priorit
19812017 "<array>\n"
19822018 "<string>%s/git</string>\n"
19832019 "<string>--exec-path=%s</string>\n"
2020+ "%s" /* For extra config parameters. */
19842021 "<string>for-each-repo</string>\n"
19852022 "<string>--keep-going</string>\n"
19862023 "<string>--config=maintenance.repo</string>\n"
@@ -1990,7 +2027,8 @@ static int launchctl_schedule_plist(const char *exec_path, enum schedule_priorit
19902027 "</array>\n"
19912028 "<key>StartCalendarInterval</key>\n"
19922029 "<array>\n" ;
1993- strbuf_addf (& plist , preamble , name , exec_path , exec_path , frequency );
2030+ strbuf_addf (& plist , preamble , name , exec_path , exec_path ,
2031+ get_extra_launchctl_strings (), frequency );
19942032
19952033 switch (schedule ) {
19962034 case SCHEDULE_HOURLY :
@@ -2226,11 +2264,12 @@ static int schtasks_schedule_task(const char *exec_path, enum schedule_priority
22262264 "<Actions Context=\"Author\">\n"
22272265 "<Exec>\n"
22282266 "<Command>\"%s\\headless-git.exe\"</Command>\n"
2229- "<Arguments>--exec-path=\"%s\" for-each-repo --keep-going --config=maintenance.repo maintenance run --schedule=%s</Arguments>\n"
2267+ "<Arguments>--exec-path=\"%s\" %s for-each-repo --keep-going --config=maintenance.repo maintenance run --schedule=%s</Arguments>\n"
22302268 "</Exec>\n"
22312269 "</Actions>\n"
22322270 "</Task>\n" ;
2233- fprintf (tfile -> fp , xml , exec_path , exec_path , frequency );
2271+ fprintf (tfile -> fp , xml , exec_path , exec_path ,
2272+ get_extra_config_parameters (), frequency );
22342273 strvec_split (& child .args , cmd );
22352274 strvec_pushl (& child .args , "/create" , "/tn" , name , "/f" , "/xml" ,
22362275 get_tempfile_path (tfile ), NULL );
@@ -2381,8 +2420,8 @@ static int crontab_update_schedule(int run_maintenance, int fd)
23812420 "# replaced in the future by a Git command.\n\n" );
23822421
23832422 strbuf_addf (& line_format ,
2384- "%%d %%s * * %%s \"%s/git\" --exec-path=\"%s\" for-each-repo --keep-going --config=maintenance.repo maintenance run --schedule=%%s\n" ,
2385- exec_path , exec_path );
2423+ "%%d %%s * * %%s \"%s/git\" --exec-path=\"%s\" %s for-each-repo --keep-going --config=maintenance.repo maintenance run --schedule=%%s\n" ,
2424+ exec_path , exec_path , get_extra_config_parameters () );
23862425 fprintf (cron_in , line_format .buf , minute , "1-23" , "*" , "hourly" );
23872426 fprintf (cron_in , line_format .buf , minute , "0" , "1-6" , "daily" );
23882427 fprintf (cron_in , line_format .buf , minute , "0" , "0" , "weekly" );
@@ -2583,7 +2622,7 @@ static int systemd_timer_write_service_template(const char *exec_path)
25832622 "\n"
25842623 "[Service]\n"
25852624 "Type=oneshot\n"
2586- "ExecStart=\"%s/git\" --exec-path=\"%s\" for-each-repo --keep-going --config=maintenance.repo maintenance run --schedule=%%i\n"
2625+ "ExecStart=\"%s/git\" --exec-path=\"%s\" %s for-each-repo --keep-going --config=maintenance.repo maintenance run --schedule=%%i\n"
25872626 "LockPersonality=yes\n"
25882627 "MemoryDenyWriteExecute=yes\n"
25892628 "NoNewPrivileges=yes\n"
@@ -2593,7 +2632,7 @@ static int systemd_timer_write_service_template(const char *exec_path)
25932632 "RestrictSUIDSGID=yes\n"
25942633 "SystemCallArchitectures=native\n"
25952634 "SystemCallFilter=@system-service\n" ;
2596- if (fprintf (file , unit , exec_path , exec_path ) < 0 ) {
2635+ if (fprintf (file , unit , exec_path , exec_path , get_extra_config_parameters () ) < 0 ) {
25972636 error (_ ("failed to write to '%s'" ), filename );
25982637 fclose (file );
25992638 goto error ;
0 commit comments