File tree Expand file tree Collapse file tree 3 files changed +20
-5
lines changed Expand file tree Collapse file tree 3 files changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -101,7 +101,7 @@ This is done to avoid disrupting the remote-tracking branches. The end users
101101expect these refs to stay unmoved unless they initiate a fetch. With prefetch
102102task, however, the objects necessary to complete a later real fetch would
103103already be obtained, so the real fetch would go faster. In the ideal case,
104- it will just become an update to bunch of remote-tracking branches without
104+ it will just become an update to a bunch of remote-tracking branches without
105105any object transfer.
106106
107107gc::
Original file line number Diff line number Diff line change @@ -1554,11 +1554,10 @@ static int update_background_schedule(int run_maintenance)
15541554while (!strbuf_getline_lf (& line , cron_list )) {
15551555if (!in_old_region && !strcmp (line .buf , BEGIN_LINE ))
15561556in_old_region = 1 ;
1557- if (in_old_region )
1558- continue ;
1559- fprintf (cron_in , "%s\n" , line .buf );
1560- if (in_old_region && !strcmp (line .buf , END_LINE ))
1557+ else if (in_old_region && !strcmp (line .buf , END_LINE ))
15611558in_old_region = 0 ;
1559+ else if (!in_old_region )
1560+ fprintf (cron_in , "%s\n" , line .buf );
15621561}
15631562
15641563if (run_maintenance ) {
Original file line number Diff line number Diff line change @@ -446,6 +446,22 @@ test_expect_success 'start preserves existing schedule' '
446446grep "Important information!" cron.txt
447447'
448448
449+ test_expect_success ' magic markers are correct' '
450+ grep "GIT MAINTENANCE SCHEDULE" cron.txt >actual &&
451+ cat >expect <<-\EOF &&
452+ # BEGIN GIT MAINTENANCE SCHEDULE
453+ # END GIT MAINTENANCE SCHEDULE
454+ EOF
455+ test_cmp actual expect
456+ '
457+
458+ test_expect_success ' stop preserves surrounding schedule' '
459+ echo "Crucial information!" >>cron.txt &&
460+ GIT_TEST_CRONTAB="test-tool crontab cron.txt" git maintenance stop &&
461+ grep "Important information!" cron.txt &&
462+ grep "Crucial information!" cron.txt
463+ '
464+
449465test_expect_success ' register preserves existing strategy' '
450466git config maintenance.strategy none &&
451467git maintenance register &&
You can’t perform that action at this time.
0 commit comments