{"thread":{"id":"59239","subject":"\"git maintenance\" - detect status?","startedAt":"2023-02-14T10:51:02Z","lastAt":"2023-02-14T17:08:36Z","messageCount":2,"participants":["Tao Klerks","Derrick Stolee"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"472055","messageId":"CAPMMpohJ1gajTYOA9ZJjq=hASA9ry9fKP02TYH2dDF+VBeek8w@mail.gmail.com","threadId":"59239","inReplyTo":null,"subject":"\"git maintenance\" - detect status?","fromName":"Tao Klerks","fromEmail":"tao@klerks.biz","sentAt":"2023-02-14T10:50:22Z","receivedAt":"2023-02-14T10:51:02Z","isPatch":false,"sender":{"key":"tao@klerks.biz","avatar":"https://avatars.githubusercontent.com/u/531704?v=4"},"body":"Hi folks,\n\nI'm trying to understand how to expose \"git maintenance\" state to\nusers, and suspect I'm missing something:\n\nI see in the doc (https://git-scm.com/docs/git-maintenance) that \"git\nmaintenance start\" does three things:\n * sets maintenance.auto = false in the current repo\n * registers the current repo into a --global maintenance.repo entry\n * starts the global schedule\n\nAlso see there that \"undoing\" this requires three separate steps:\n * \"git maintenance stop\" for the schedule\n * \"git maintenance unregister\" for the maintenance.repo entry\n * \"git config --unset maintenance.auto to resume legacy maintenance\n\nHowever, I can't figure out how to test the current state of\nscheduling, from within git:\n * There's no config value representing \"scheduling is enabled\" (as\nfar as I can tell)\n * There's no \"git maintenance\" subcommand for \"check on the\nscheduling tasks\" (as far as I can tell)\n\nIn principle I guess it's possible to check for the Task Scheduler\nentries and their status in Windows, for example, but that sounds...\nlike relying on implementation details.\n\nIs there any correct cross-platform way to detect the scheduling state?\n\nThanks,\nTao\n"},{"id":"472062","messageId":"2eb324c9-4908-5ace-4724-72c2815674fb@github.com","threadId":"59239","inReplyTo":"CAPMMpohJ1gajTYOA9ZJjq=hASA9ry9fKP02TYH2dDF+VBeek8w@mail.gmail.com","subject":"Re: \"git maintenance\" - detect status?","fromName":"Derrick Stolee","fromEmail":"derrickstolee@github.com","sentAt":"2023-02-14T17:07:58Z","receivedAt":"2023-02-14T17:08:36Z","isPatch":false,"sender":{"key":"stolee@gmail.com","avatar":"https://avatars.githubusercontent.com/u/570044?v=4"},"body":"On 2/14/2023 5:50 AM, Tao Klerks wrote:\n\n> However, I can't figure out how to test the current state of\n> scheduling, from within git:\n>  * There's no config value representing \"scheduling is enabled\" (as\n> far as I can tell)\n>  * There's no \"git maintenance\" subcommand for \"check on the\n> scheduling tasks\" (as far as I can tell)\n> \n> In principle I guess it's possible to check for the Task Scheduler\n> entries and their status in Windows, for example, but that sounds...\n> like relying on implementation details.\n> \n> Is there any correct cross-platform way to detect the scheduling state?\n\nNot currently, but you do make a good point about the scheduler\nbeing an implementation detail.\n\nYou're making a good case for a new subcommand like 'git maintenance\nstatus' that would report these details. It could even be a three-\ntiered result:\n\n  $ git maintenance status\n  global scheduler: on\n  repository schedule: enabled\n  foreground maintenance: disabled\n\n...or something like that. Not sure how to properly describe the\nmaintenance.auto config option as anything other than \"foreground\nmaintenance\", even if it launches maintenance processes in the\nbackground on most platforms.\n\nOf course, it could be worth exploring more about the specific\nschedule the repository is scheduled for. It could describe the\nmaintenance.strategy value that is assumed (if there is one) or\neven break down the tasks that will be run on different cadences:\n\n  $ git maintenance status\n  global scheduler: on\n  repository schedule: enabled\n    strategy: incremental\n    hourly: prefetch, commit-graph\n    daily: incremental-repack\n    weekly: pack-refs\n  foreground maintenance: disabled\n\nFinally, making this something machine-readable (say, key=value\nlines or JSON output) could be valuable behind an argument.\n\nThese are all just \"top of mind\" thoughts when I read your\nquestions, so feel free to disregard any or all of it. Just\nideas to think about.\n\nThanks,\n-Stolee\n"}]}