@@ -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.
@@ -1974,6 +2010,7 @@ static int launchctl_schedule_plist(const char *exec_path, enum schedule_priorit
19742010 "<array>\n"
19752011 "<string>%s/git</string>\n"
19762012 "<string>--exec-path=%s</string>\n"
2013+ "%s" /* For extra config parameters. */
19772014 "<string>for-each-repo</string>\n"
19782015 "<string>--keep-going</string>\n"
19792016 "<string>--config=maintenance.repo</string>\n"
@@ -1983,7 +2020,8 @@ static int launchctl_schedule_plist(const char *exec_path, enum schedule_priorit
19832020 "</array>\n"
19842021 "<key>StartCalendarInterval</key>\n"
19852022 "<array>\n" ;
1986- strbuf_addf (& plist , preamble , name , exec_path , exec_path , frequency );
2023+ strbuf_addf (& plist , preamble , name , exec_path , exec_path ,
2024+ get_extra_launchctl_strings (), frequency );
19872025
19882026 switch (schedule ) {
19892027 case SCHEDULE_HOURLY :
@@ -2218,11 +2256,12 @@ static int schtasks_schedule_task(const char *exec_path, enum schedule_priority
22182256 "<Actions Context=\"Author\">\n"
22192257 "<Exec>\n"
22202258 "<Command>\"%s\\headless-git.exe\"</Command>\n"
2221- "<Arguments>--exec-path=\"%s\" for-each-repo --keep-going --config=maintenance.repo maintenance run --schedule=%s</Arguments>\n"
2259+ "<Arguments>--exec-path=\"%s\" %s for-each-repo --keep-going --config=maintenance.repo maintenance run --schedule=%s</Arguments>\n"
22222260 "</Exec>\n"
22232261 "</Actions>\n"
22242262 "</Task>\n" ;
2225- fprintf (tfile -> fp , xml , exec_path , exec_path , frequency );
2263+ fprintf (tfile -> fp , xml , exec_path , exec_path ,
2264+ get_extra_config_parameters (), frequency );
22262265 strvec_split (& child .args , cmd );
22272266 strvec_pushl (& child .args , "/create" , "/tn" , name , "/f" , "/xml" ,
22282267 get_tempfile_path (tfile ), NULL );
@@ -2363,8 +2402,8 @@ static int crontab_update_schedule(int run_maintenance, int fd)
23632402 "# replaced in the future by a Git command.\n\n" );
23642403
23652404 strbuf_addf (& line_format ,
2366- "%%d %%s * * %%s \"%s/git\" --exec-path=\"%s\" for-each-repo --keep-going --config=maintenance.repo maintenance run --schedule=%%s\n" ,
2367- exec_path , exec_path );
2405+ "%%d %%s * * %%s \"%s/git\" --exec-path=\"%s\" %s for-each-repo --keep-going --config=maintenance.repo maintenance run --schedule=%%s\n" ,
2406+ exec_path , exec_path , get_extra_config_parameters () );
23682407 fprintf (cron_in , line_format .buf , minute , "1-23" , "*" , "hourly" );
23692408 fprintf (cron_in , line_format .buf , minute , "0" , "1-6" , "daily" );
23702409 fprintf (cron_in , line_format .buf , minute , "0" , "0" , "weekly" );
@@ -2564,7 +2603,7 @@ static int systemd_timer_write_service_template(const char *exec_path)
25642603 "\n"
25652604 "[Service]\n"
25662605 "Type=oneshot\n"
2567- "ExecStart=\"%s/git\" --exec-path=\"%s\" for-each-repo --keep-going --config=maintenance.repo maintenance run --schedule=%%i\n"
2606+ "ExecStart=\"%s/git\" --exec-path=\"%s\" %s for-each-repo --keep-going --config=maintenance.repo maintenance run --schedule=%%i\n"
25682607 "LockPersonality=yes\n"
25692608 "MemoryDenyWriteExecute=yes\n"
25702609 "NoNewPrivileges=yes\n"
@@ -2574,7 +2613,7 @@ static int systemd_timer_write_service_template(const char *exec_path)
25742613 "RestrictSUIDSGID=yes\n"
25752614 "SystemCallArchitectures=native\n"
25762615 "SystemCallFilter=@system-service\n" ;
2577- if (fprintf (file , unit , exec_path , exec_path ) < 0 ) {
2616+ if (fprintf (file , unit , exec_path , exec_path , get_extra_config_parameters () ) < 0 ) {
25782617 error (_ ("failed to write to '%s'" ), filename );
25792618 fclose (file );
25802619 goto error ;
0 commit comments