@@ -1686,6 +1686,42 @@ static const char *get_frequency(enum schedule_priority schedule)
16861686 }
16871687}
16881688
1689+ static const char * extraconfig [] = {
1690+ "credential.interactive=false" ,
1691+ "core.askPass=true" , /* 'true' returns success, but no output. */
1692+ NULL
1693+ };
1694+
1695+ static const char * get_extra_config_parameters (void ) {
1696+ static const char * result = NULL ;
1697+ struct strbuf builder = STRBUF_INIT ;
1698+
1699+ if (result )
1700+ return result ;
1701+
1702+ for (const char * * s = extraconfig ; s && * s ; s ++ )
1703+ strbuf_addf (& builder , "-c %s " , * s );
1704+
1705+ result = strbuf_detach (& builder , NULL );
1706+ return result ;
1707+ }
1708+
1709+ static const char * get_extra_launchctl_strings (void ) {
1710+ static const char * result = NULL ;
1711+ struct strbuf builder = STRBUF_INIT ;
1712+
1713+ if (result )
1714+ return result ;
1715+
1716+ for (const char * * s = extraconfig ; s && * s ; s ++ ) {
1717+ strbuf_addstr (& builder , "<string>-c</string>\n" );
1718+ strbuf_addf (& builder , "<string>%s</string>\n" , * s );
1719+ }
1720+
1721+ result = strbuf_detach (& builder , NULL );
1722+ return result ;
1723+ }
1724+
16891725/*
16901726 * get_schedule_cmd` reads the GIT_TEST_MAINT_SCHEDULER environment variable
16911727 * to mock the schedulers that `git maintenance start` rely on.
@@ -1892,6 +1928,7 @@ static int launchctl_schedule_plist(const char *exec_path, enum schedule_priorit
18921928 "<array>\n"
18931929 "<string>%s/git</string>\n"
18941930 "<string>--exec-path=%s</string>\n"
1931+ "%s" /* For extra config parameters. */
18951932 "<string>for-each-repo</string>\n"
18961933 "<string>--keep-going</string>\n"
18971934 "<string>--config=maintenance.repo</string>\n"
@@ -1901,7 +1938,8 @@ static int launchctl_schedule_plist(const char *exec_path, enum schedule_priorit
19011938 "</array>\n"
19021939 "<key>StartCalendarInterval</key>\n"
19031940 "<array>\n" ;
1904- strbuf_addf (& plist , preamble , name , exec_path , exec_path , frequency );
1941+ strbuf_addf (& plist , preamble , name , exec_path , exec_path ,
1942+ get_extra_launchctl_strings (), frequency );
19051943
19061944 switch (schedule ) {
19071945 case SCHEDULE_HOURLY :
@@ -2136,11 +2174,12 @@ static int schtasks_schedule_task(const char *exec_path, enum schedule_priority
21362174 "<Actions Context=\"Author\">\n"
21372175 "<Exec>\n"
21382176 "<Command>\"%s\\headless-git.exe\"</Command>\n"
2139- "<Arguments>--exec-path=\"%s\" for-each-repo --keep-going --config=maintenance.repo maintenance run --schedule=%s</Arguments>\n"
2177+ "<Arguments>--exec-path=\"%s\" %s for-each-repo --keep-going --config=maintenance.repo maintenance run --schedule=%s</Arguments>\n"
21402178 "</Exec>\n"
21412179 "</Actions>\n"
21422180 "</Task>\n" ;
2143- fprintf (tfile -> fp , xml , exec_path , exec_path , frequency );
2181+ fprintf (tfile -> fp , xml , exec_path , exec_path ,
2182+ get_extra_config_parameters (), frequency );
21442183 strvec_split (& child .args , cmd );
21452184 strvec_pushl (& child .args , "/create" , "/tn" , name , "/f" , "/xml" ,
21462185 get_tempfile_path (tfile ), NULL );
@@ -2281,8 +2320,8 @@ static int crontab_update_schedule(int run_maintenance, int fd)
22812320 "# replaced in the future by a Git command.\n\n" );
22822321
22832322 strbuf_addf (& line_format ,
2284- "%%d %%s * * %%s \"%s/git\" --exec-path=\"%s\" for-each-repo --keep-going --config=maintenance.repo maintenance run --schedule=%%s\n" ,
2285- exec_path , exec_path );
2323+ "%%d %%s * * %%s \"%s/git\" --exec-path=\"%s\" %s for-each-repo --keep-going --config=maintenance.repo maintenance run --schedule=%%s\n" ,
2324+ exec_path , exec_path , get_extra_config_parameters () );
22862325 fprintf (cron_in , line_format .buf , minute , "1-23" , "*" , "hourly" );
22872326 fprintf (cron_in , line_format .buf , minute , "0" , "1-6" , "daily" );
22882327 fprintf (cron_in , line_format .buf , minute , "0" , "0" , "weekly" );
@@ -2482,7 +2521,7 @@ static int systemd_timer_write_service_template(const char *exec_path)
24822521 "\n"
24832522 "[Service]\n"
24842523 "Type=oneshot\n"
2485- "ExecStart=\"%s/git\" --exec-path=\"%s\" for-each-repo --keep-going --config=maintenance.repo maintenance run --schedule=%%i\n"
2524+ "ExecStart=\"%s/git\" --exec-path=\"%s\" %s for-each-repo --keep-going --config=maintenance.repo maintenance run --schedule=%%i\n"
24862525 "LockPersonality=yes\n"
24872526 "MemoryDenyWriteExecute=yes\n"
24882527 "NoNewPrivileges=yes\n"
@@ -2492,7 +2531,7 @@ static int systemd_timer_write_service_template(const char *exec_path)
24922531 "RestrictSUIDSGID=yes\n"
24932532 "SystemCallArchitectures=native\n"
24942533 "SystemCallFilter=@system-service\n" ;
2495- if (fprintf (file , unit , exec_path , exec_path ) < 0 ) {
2534+ if (fprintf (file , unit , exec_path , exec_path , get_extra_config_parameters () ) < 0 ) {
24962535 error (_ ("failed to write to '%s'" ), filename );
24972536 fclose (file );
24982537 goto error ;
0 commit comments